In ActionScript Bytecode, what does NewActivation mean?

Some methods use some of them, it is obvious that they are defined using the requireActivation flag, the nut, what does it do, and when to use it, and when not?

Information about AVM documents is somewhat inexpressive:

Creates a new activation object, newactivation, and pushes it on the stack. It can only be used in methods in which the NEED_ACTIVATION flag is set in their MethodInfo record.

+3
source share
1 answer

Section 6.3 of the AVM 2 review has a good description:

, newfunction, . newactivation .

, , , :

public function QuickTest()
{
    startTimer(1);
    startTimer(2);
}

public function startTimer(id:int):void
{
    var timer:Timer = new Timer(1000, 1);
    timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(ev:TimerEvent):void
    {
        trace('Timer #'+id+' done.');
    });
    timer.start();        
}       

:

Timer #1 done.
Timer #2 done.

, "" . , startTimer , , , . , :

Timer #2 done.
Timer #2 done.
+4

All Articles