Reuse externally loaded elements

Supposing I have an XML file which defines the structure, layout, and graphical elements to use in my site, and the Flash movie loads the XML file first and then arranges itself accordingly... I want to preload all of the images whose paths are defined in the XML file (easy, already did that part) but then I want to reuse them... essentially preload them into client memory or onto the client's Flash player stage, but out of sight, until they are needed in the movie. How do I reference an externally loaded image or movie from within the main movie, and move it/place it accordingly?

Note that this is not as simple as merely loading the file into a blank movie clip and then moving the clip into position when the time comes; rather, the file must be able to be placed into other parts of the movie itself; in other layers nested in several tiers of movie clips, etc. etc.

If the file has been downloaded and placed onto the stage, and can be manipulated accordingly, then it must also be accessible in the same way, right?
LVL 2
sexyrexyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZefferCommented:
one approach could be loading into levels

if the content in an imported clip was in a movieclip..and that movieclip had an instance name..say..clipOne..and the swf holding it was loaded into ..say _level3
then clipOne could be referenced by

setProperty._level3.clipOne._x = 200 ;
setProperty._level3.clipOne._y = 200;

clipOne would need to be well off the stage in it's carrier swf..so it could load and not
be seen until it was moved

this would be fine if you are 'stacking' content in the main movie.

to access clips from inside other clips on the stage..you would use attachMovie
which calls items in the library which  have been loaded with the main movie.

see flash Help..
Index>Linking>movieclips

you can remove levels with..unloadMovieNum();
or attached clips with..movieClip.removeMovieClip();

until these actions are used the clips will stay in the player memory

Z
sexyrexyAuthor Commented:
I understand both of those methods, my problem is that I cannot use attachMovie because that would require actually placing the media files inside the original FLA and setting them to export, but the whole purpose is for the media files to change and be defined purely by the XML file.

Moving the clip is close but not good enough; the loaded clip(s) must be masked and the XML file defines which clips and parts of the movie into which they are eventually placed, so I can't load them to a layer and just change their x and y positions... they actually need to be in this clip or that clip, which is determined at runtime. Is there any other way? (I imagine no, unless there is an entire method in Actionscript that I am unaware of... I'm trying just for the heck of it though)

Also any ideas for alternative methods to simulate the same result as I have explained would be good...
ZefferCommented:
yes i see what you mean..if the placement is determined at runtime..levels  won't
do it.

what you describe..
>>but the whole purpose is for the media files to change and be defined purely by the XML file.<<
sounds like requiring an xml socket.

>>ActionScript provides a built-in XMLSocket object that allows you to open a continuous connection with a server. A socket connection allows the server to publish (or "push") information to the client as soon as that information is available. Without a continuous connection, the server must wait for an HTTP request. This open connection removes latency issues and is commonly used for real-time applications such as chats. The data is sent over the socket connection as one string and should be in XML format. You can use the XML object to structure the data. <<

if you have preloaded your images with ._visibilty = false;
you should be able to manipulate them in realtime.. from the main timeline.

for more see..
help>contents>connecting with external sources>using the xml socket object

Z

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.