PDA

View Full Version : Need help accessing via ActionScript, a Layer in another SWF


threedfx1
04-27-2005, 02:40 AM
Hi!
I am still fairly new at ActionScripting and self-taught. I've been searching the forums and can't find a way to resolve this issue.
I have several swf files imbedded in a main swf ( I know nothing special) One of the swf files (call it map.swf) was created with Adobe Illustrator and is map of the world as an import. Each country is in its own layer. Thru a movieLoader the map.swf file is loaded into my main swf into a layer called base. I know I can access it as _level0.main.base for example. From a web page I want to pass the name of a country to main.swf which intern hilights the country in the map.swf. I use a LocalConnection() to receive the country's name and this part works fine. However, I'm not sure how to either pass the country name to map.swf or create and call a function that resides within map.swf. Or is this even possible? :confused:

Thanks for any advice.
Threedfx

Barn
04-27-2005, 05:17 AM
Everything at run-time is in terms of instance names -- the names of the SWF files are no longer known by the Flash player. So you need to refer to those movies in your description of the problem by the instance name that describes where they reside (after loading, in the case of dynamically loaded SWFs).

(By the way, SWFs are not "embedded" unless you import them and place them on the stage in the authoring environment.)

And if you don't know the path, for instance, in your "main.swf", place this action on one of the frames in its main timeline in the authoring environment:

trace("main.swf is located at: "+this);
And then watch the output window when you run your movie. Same thing for any of the others. Or variables -- if you want to know where they are trace them in the timeline where you stored them, i.e.:

myVar = "whatever";
trace("myVar is located at: "+this);

threedfx1
04-27-2005, 07:54 PM
I guess I didn't explain myself well. Let's try this again... I am passing a country name from my webpage to a transmitter.swf. The transmitter.swf uses a LocalConnection to send this country name to my main.swf. The main.swf receives the country name just fine. It also uses a MovieClipLoader to load a map.swf into "_root.map.base".

What I'm trying to do now is pass the country name to the map. When the main.swf receives the country name, I'm trying to use another localConnection to send it to the map. The map.swf also contains code to receive the string. I've tried using the example on this link as guidance:
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary441.html

I wanted to post my watered fla's but could not attach my zip file to do so.
Thank you for any help.
Threedfx1