Solved

Reuse externally loaded elements

Posted on 2003-12-04
3
188 Views
Last Modified: 2010-04-03
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?
0
Comment
Question by:sexyrexy
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Zeffer
ID: 9879971
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
0
 
LVL 2

Author Comment

by:sexyrexy
ID: 9880371
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...
0
 
LVL 23

Accepted Solution

by:
Zeffer earned 150 total points
ID: 9881092
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
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

706 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

20 Experts available now in Live!

Get 1:1 Help Now