Solved

Preloading images in Flash

Posted on 2009-04-02
2
523 Views
Last Modified: 2013-11-11
I am making a Flash app to rotate logos as can be seen on: http://www.james.nedlinux.com/logo_rotator.html.
The colored blocks are jpg images that represent company logos and they are loaded into the Flash application from an XML file using loadMovie.

How I implemented this:

I have a movieclip which is twice the size of my Flash file. The right part of the mc is not viewable because it is on the right of my viewport. I load every new logo into this right part. Then I play the mc that will move the logo into the viewport during 30 frames. The left part of the mc is now not viewable. Then I load the same logo into that left part, so I can move the mc back to the right in 1 frame without noticing. Then again a new logo is loaded... etc..

Problems:

1) Every logo is loaded twice everytime is it shown (appear and disappear). Is it possible to copy the content of a movieclip to another movieclip?
2) When the cyclus ends, I don't want to load all logos again for the next cyclus. How to fix that?
0
Comment
Question by:thijs321
2 Comments
 
LVL 12

Accepted Solution

by:
scooby_56 earned 500 total points
ID: 24052188
Do this in AS3 and the following applies

1)
you can use addChild to switch parents
for example... if myContainer1 has myLogoA and you want to move the logo to myContainer2 just use
myContainer2.addChild(myLogoA);

this will automatically remove from from myContainer1 and place inside myContainer2 effectively copying from one to another
2)
put logos into an array or some variable with meaningfull names. Even if you use removeChild(), the variable will still reference the logo and you can use it with addChild() later.
0
 

Author Comment

by:thijs321
ID: 24261147
Is it also possible in AS1 or AS2?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now