Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

External swf constructor execution

New Here ,
Dec 11, 2013 Dec 11, 2013

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?

TOPICS
ActionScript
726
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Dec 11, 2013 Dec 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2013 Dec 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

     }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Dec 11, 2013 Dec 11, 2013

you are kidding, i guess. I wrote:

Not if you not explicitly program it this way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2013 Dec 11, 2013

So when the code in the constructor of the external.swf is executed, the code of the main.swf has to wait?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 11, 2013 Dec 11, 2013
LATEST

You probably have two things going on here

  1. Your loop is still running, so the timer event handler can't fire
  2. The extra time may be giving your timer time to be garbage collected, so it never fires.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines