Skip to main content
Known Participant
March 4, 2015
Question

Swf Loading Error

  • March 4, 2015
  • 1 reply
  • 320 views

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

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 4, 2015

the line of code causing that error is not shown in your message.

click file>publish settings>swf and tick 'enable debugging'.  retest.

the error message will can the timeline/class and line number of the problematic code.

Known Participant
March 4, 2015

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()

Line 15 is braces after the public function Main()----this class files Main.as belongs to the QuestionAnsAnwer.fla , in which i am trying to load all the other swf.....

kglad
Community Expert
Community Expert
March 4, 2015

copy and paste the first 20 lines or so of Main.as