Adobe Flash Builder (flex4): addChild() is not available in this class.

前端 未结 4 405
悲&欢浪女
悲&欢浪女 2020-12-30 11:12

I want to load an swf into a flex 4 application in order to use its classes.

var ldr:Loader=new Loader();
ldr.load(new URLRequest(\"file://path/to/fileswf\")         


        
4条回答
  •  旧巷少年郎
    2020-12-30 11:23

    private var _loader:SWFLoader = new SWFLoader();
    private var _uicomponent:UIComponent = new UIComponent();
    private function swfLoaded(event:Event):void 
    {
    Alert.show("inside swf Loaded");
    var content:DisplayObject =_loader.content;
    _uicomponent.addChild(content);
    } 
    public function loadSWF () : void 
    {   
    
    _loader.addEventListener(Event.INIT, swfLoaded);
    _loader.load("http://intelliveysoft.com:5080/myelearn/Admin.swf"); 
    addElement(_uicomponent);
    }
    

    Try this. It will work

提交回复
热议问题