Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , , ,

Sponsored Links



Automatically resize images from an XML

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 22-01-2010
Member
 
Join Date: Jun 2009
Posts: 3,865
Automatically resize images from an XML

I want to display images in an empty clip via loadMovie. Until that no worries. Buttons allow me to scroll through the images that are called via an xml file.

Now I want to resize images automatically (which are all different sizes), either with a width of 70% of the scene if the image is Landscape or with a height of 70% of the scene if the image is portrait. And this, keeping the ratio H/L of origin!

Here is my view function:
Code:
function display (variable) (
unload (myClipContainer);
loadMovie (myURLImages [variable] myClipContainer);
charger.onEnterFrame = function () (
if ((myClipContainer.getBytesLoaded () == myClipContainer.getBytesTotal ()) & & (myClipContainer.getBytesTotal ()> 0)) (
delete this.onEnterFrame;
width = myClipContainer._width;
height = myClipContainer._height;
ratio = width / height;
if (width> height) (
myClipContainer._width = Stage.width *. 7;
myClipContainer._height = myClipContainer._width / report;
Else ()
 
myClipContainer._height = Stage.height *. 7;
myClipContainer._width = myClipContainer._height / report;
    };
   };
  };
};
It works very well to display the first photo. But from the 2nd, and even if I come back on the 1st, myClipContainer._height keeps the display size of the previous image. If I trace myClipContainer._height at the end of the load (on the line above delete) it lacks the size myURLImages [variable] as I thought it would. Is there way to restore myURLImages [variable]. _x And. _y?
Reply With Quote
  #2  
Old 22-01-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
Re: Automatically resize images from an XML

This is normal, you have beautiful "unloader" myClipContainer, it does not remove the property provided it therefore retains its size. Rather than "unload", you can try "delete".
Reply With Quote
  #3  
Old 22-01-2010
Member
 
Join Date: Jun 2009
Posts: 3,865
Re: Automatically resize images from an XML

Actually, I think you have clearly identified my concern!

but:
the result is the same with delete
trace (myClipContainer._width) returns me the size of the old myClipContainer, even if put 1 line in the delete, the delete does not seem to remove either the properties

What I do not understand is that even trace placed 1st in line if that verifies the completion of loading refers me also the size of the old myClipContainer.

Oh I found!

In fact myClipContainer must be established "dynamically via createEmptyMovieClip AS (" myClipContainer ", 0);
(I had created in the flash library)

So, no need to delete or even to unload the holderClip takes the dimensions of the image loaded each time and I have done my resizing operations.
Reply With Quote
  #4  
Old 22-01-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
Re: Automatically resize images from an XML

Yes, that's what I could tell you, but I thought that delete would solve the thing. Shame on AS2 which by its on-tolerance does not help to understand the problem.

The AS3 has a very different philosophy ...

You could just out of curiosity try this script:
in addition to unload, crush myClipContainer redefining a new MovieClip ...

Code:
    function view(Variable) {
    myClipContainer = new MovieClip();
    myClipContainer.loadMovie(myURLImages[Variable]);
    charger.onEnterFrame = function() {
                if ((myClipContainer.getBytesLoaded() == myClipContainer.getBytesTotal()) && (myClipContainer.getBytesTotal()>0)) {    
                    delete this.onEnterFrame;
    width = myClipContainer._width;
    height = myClipContainer._height;
    ratio = width / height;
                    if (width> height) {
    myClipContainer._width = Stage.width*.7;
    myClipContainer._height = myClipContainer._width/ report;
                    } else {
     
    myClipContainer._height = Stage.height*.7;
    myClipContainer._width = myClipContainer._height/ report;
                    };
                };
            };
    };
Reply With Quote
  #5  
Old 22-01-2010
Member
 
Join Date: Jun 2009
Posts: 3,865
Re: Automatically resize images from an XML

(important info: I'm not a big shot in AS, I opened Flash for the first time in my life 15 days ago)

Basically what you are asking me to try do not work. There is no image loaded. I have this error: Target not found: Target = "undefined" Base = "_level0"

In fact, in my old AS (which works) I "createEmptyMovieClip ("myClipContainer", 0);" which is IN the function
then recreated each time.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Automatically resize images from an XML"
Thread Thread Starter Forum Replies Last Post
Auto resize images while importing in Microsoft Excel SirName Windows Software 3 3 Weeks Ago 01:01 PM
How to automatically resize the embedded vlc player FunnyBHUSAN Windows Software 4 19-04-2011 11:46 AM
resize images with outlook express Abshir Windows Software 3 16-06-2009 12:08 AM
How to rename/resize images in Linux ? Eleazar Operating Systems 3 17-03-2009 03:28 PM
Resize images using Powertoy in Windows XP AmdUser Windows Software 3 07-02-2009 07:09 PM


All times are GMT +5.5. The time now is 03:41 AM.