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.
- Cliff