AS3 : How to target sub-MC of loaded .swf?

Hey everyone. I’m new to AS3 and very… very lost (Last time I did much with flash was Flash 5).

Short version: I’m trying to load an external .swf from a URL and add event handlers to the movie clips (or it’s movie clips sub-MCs) on its stage. I can’t find a THING online on how to do this.

Details:

I’ve been tasked by my employer to build a simple control interface in flash, with just a few buttons to do things like display some info or images or maybe an associated MP3. I’ve written little test apps to do all of these individual things & managed to fake my way through.

But the sticking point is that I’m now trying to place all the UI controls into an external .swf, which I then load into the canvas by a URL. The goal is to be able to load it into a variable named, say, ‘private _ui:MovieClip’ and then add event handlers to mivie clips within that by name like:

_ui.someButton1.addEventListener(MouseEvent.MOUSE_UP, handlerFunction1);
_ui.controlStrip.someButton2.addEventListener(MouseEvent.MOUSE_UP, handlerFunction2);

The goal is that if we want to swap out the UI for a particular client, we just export a new .swf with all the correctly named MC instances & use the new URL to load the UI.

I seem to be able to load the .swf OK and trace the movie clips “Main Timeline” like so:

_ui2.contentLoaderInfo.addEventListener(Event.COMPLETE , uiDidLoad);
function uiDidLoad(evt:Event){
trace(“UI2 LOADED”);
if(_ui2.content){
addChild(_ui2);
trace(_ui2.content); //–> [object MovieClip]
// Target the “ControlStrip” named instance on the loaded .swf’s main timeline
trace(_ui2.content.controlStrip); //–> ERROR
}
}

Can anyone point me in the right direction here? I’ve spent hours making no headway on this. I think I’ve read half of adobe’s website so far. :frowning:

  • Cliff

I just ran across this post. I have almost a similar issue with targeting clips.

Here is what I am trying to do. I have a main.as(This is my Document class) that pulls in a video class(a bunch of functions). In the video class I have a player.swf load in it. I tell main.as(class) when it is done. Now at that point I am trying to target the header_mc inside the player.swf from my main.as class. It seems if I call the header_mc from within the video class it works but if I try to target it from main.as it is a no go. Is there a way to target clips inside a swf that was loaded from an imported class.

So just to help understand this.
Main.as is the document class
– imports video.as and adds new instance (public var my_video:VideoClass = new VideoClass(“player.swf”))
---- Inside video.as I load “player.swf” (player.swf contains a header_mc.txt.text)
Main.as is told that video.as and player.swf is done.
in Main.as I am trying to target header_mc.txt to add info in it. but so far I have had no luck.

Has anyone tried this and is this possible?

Thanks in advance for your help.
–Jose