Skip to main content
Participant
December 11, 2013
Question

External swf constructor execution

  • December 11, 2013
  • 1 reply
  • 786 views

I was wondering, if you load an external swf, would its document's class constructor execution stop the execution of a code in the main swf which loads the external one?

This topic has been closed for replies.

1 reply

Inspiring
December 11, 2013

Not if you not explicitly program it this way.

In other words there is no automatism that pauses or stops the main.swf from executing whatever routines you have running.

vundevAuthor
Participant
December 11, 2013

I think that's not true, prove me if I am not right. I have done the following test:

main.swf:

// constructor

stage.frameRate = 30
var loader:Loader = new Loader()
loader.load(new URLRequest('external.swf'))

var timer:Timer = new Timer(30)

timer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void{

     trace('timer')

})

timer.start()

external.swf:


var t = getTimer();

for (var j:int = 0; j < 10; j++) {

                  

     trace('tick ' + (getTimer() - t))

}

var doSomeHardStaff:Function = function():void{

     for (var i:int = 0; i < 60000; i++)

     {

          var a:int = Math.sqrt(Math.sin(33) / i * Math.random())

          var b:int = Math.sqrt(Math.sin(35) / i * Math.random())

          var c:int = Math.sqrt(Math.sin(13) / i * Math.random())

          var d:int = Math.sqrt(Math.sin(83) / i * Math.random())

          var e:int = Math.sqrt(Math.sin(323) / i * Math.random())

          a + b / c - d * e

     }

}

Inspiring
December 11, 2013

you are kidding, i guess. I wrote:

Not if you not explicitly program it this way.