Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
}
}
Copy link to clipboard
Copied
you are kidding, i guess. I wrote:
Not if you not explicitly program it this way.
Copy link to clipboard
Copied
So when the code in the constructor of the external.swf is executed, the code of the main.swf has to wait?
Copy link to clipboard
Copied
You probably have two things going on here
Find more inspiration, events, and resources on the new Adobe Community
Explore Now