Copy link to clipboard
Copied
public function main() { | <<<< CLASS CONSTRUCTOR | ||
this.addEventListener(Event.ADDED_TO_STAGE,startapp) | |||
} | |||
private function startapp(event:Event):void{ | |||
trace('start app') <<TRACING TWICE.. | |||
//instructionscreen() | |||
closebtn.visible=false | |||
closebtn.alpha=0 | |||
controls.alpha=0 | |||
} |
Copy link to clipboard
Copied
package
{
import flash.events.*;
import flash.display.*
public class Testing extends MovieClip
{
public function Testing()
{
addEventListener(Event.ADDED_TO_STAGE,startapp)
}
private function startapp(event:Event):void
{
trace('start app')
//instructionscreen()
closebtn.visible=false
closebtn.alpha=0
//controls.alpha=0
}
}
}
its running for once only
Copy link to clipboard
Copied
Also remove the Event.ADDED_TO_STAGE listener in startapp function.
Copy link to clipboard
Copied
You can do something like this :
package
{
import flash.events.Event;
import flash.display.*
public class Testing extends MovieClip
{
public function Testing()
{
if (stage) startapp();
else addEventListener(Event.ADDED_TO_STAGE,startapp);
}
private function startapp(event:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE,startapp);
trace('start app')
//instructionscreen()
closebtn.visible=false
closebtn.alpha=0
//controls.alpha=0
}
}
}