I load a swf and want to get a button in the swf. But the button I get is NULL. I am sure the button's name is right and exists. Could somebody help me to solve this problem?
package
{
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.SimpleButton;
import flash.display.LoaderInfo;
public class MyClass1 extends MovieClip
{
public function MyClass1()
{
super();
var swfLoader:Loader = new Loader();
addChild(swfLoader);
var bgURL:URLRequest = new URLRequest("secondFlash.swf");
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
swfLoader.load(bgURL);
var currentSWF:MovieClip = new MovieClip();
function loadProdComplete(e:Event):void {
var loaderInfo:LoaderInfo = e.target as LoaderInfo;
var mv:MovieClip= MovieClip(loaderInfo.content);
var btn1 = mv.getChildByName("btn1") as SimpleButton;
trace("mv"+mv);
trace("btn1="+btn1);
}
}
}
}
North America
Europe, Middle East and Africa
Asia Pacific