Swf Loading Error
Hi,
I am having four to five swf which need to be loaded dynamically based on user click into Main.swf.But when, I try to load a swf which as many MC in stage and also added to stage dynamically into Main.swf, It's displaying following error.
Codding:
| public function Main() | |||
| { | |||
| if(stage) | |||
| { | |||
| initStage(); | |||
| } | |||
| else | |||
| { | |||
| addEventListener(Event.ADDED_TO_STAGE,initStage); | |||
| } | |||
| } | |||
| //function called when stage is initialized | |||
| private function initStage(evt:Event = null) | |||
| { | |||
| removeEventListener(Event.ADDED_TO_STAGE,initStage); | |||
| initData(); | |||
| } | |||
| private function initData() | |||
| { | |||
| var url:String = "DragAndDrop.swf"; | |||
| var urlReq:URLRequest = new URLRequest(url); | |||
| loader = new Loader(); | |||
| loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaded) | |||
| loader.load(urlReq); | |||
| //this.addChild(loader); | |||
| } | |||
| private function onLoaded(evt:Event) | |||
| { | |||
| this.addChild(loader); | |||
| //var targetSwf:MovieClip = MovieClip(loader.content); | |||
| //trace("targetSwf="+targetSwf); | |||
| //this.addChild(targetSwf); | |||
| } |
Error:
ReferenceError: Error #1056: Cannot create property question_mc on Main.
at flash.display::Sprite/flash.display:Sprite::constructChildren()
at flash.display::Sprite$iinit()
at flash.display::MovieClip$iinit()
at Main$iinit()
Can anyone help me out why this error is coming, I need to establish communication between all swf's..I am using CS3 suit...
