Link to home
Start Free TrialLog in
Avatar of CauseLs
CauseLs

asked on

URLRequest Image Has to reload everytime it's called... why??

I have a slide-show type animation that loads dynamic content from files using URLRequest as in the code below.  Every time my show returns to this slide it must reload the picture which obviously will be bad for those with a slower connection.

So basically my question is how can I load the image once, perhaps store it in cache, and call it again without having to reload?  Thanks.
pic1.load(new URLRequest("pic1.jpg"));

Open in new window

Avatar of Eaddy Barnes
Eaddy Barnes
Flag of United States of America image

perhaps you could introduce a Boolean variable that determines if the image has been loaded or not! if yes just make that image visible again.



Avatar of CauseLs
CauseLs

ASKER

I'd prefer to not have to do it that way, the way my timeline is designed it jumps around and would be quite messy to have all objects on the stage only invisible.

I've actually had a bit of success since my posting with using the code below.  It appears to not have to reload the image every time I say

pic1.addChild(temp);

Just throws it right on the stage.  Now I just need to figure out how to constrain the image to the preset "pic1" container..  Any idea how to set addChild to autofit inside an graphic block?
var temp:Loader = new Loader();
temp.load(new URLRequest("pic1.jpg"));
pic1.addChild(temp);

Open in new window

put that code in the timeline of a MovieClip symbol
ASKER CERTIFIED SOLUTION
Avatar of Eaddy Barnes
Eaddy Barnes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CauseLs

ASKER

Ended up changing from a Loader object to a UILoader object so I could use the property "maintainAspectRatio" but your help got me on the right track!  Thanks a lot!