flash - How to create a custom property/method inside a MovieClip? (AS3) -


i'm programming kind of "lights off" game in flash professional (not flash/flex builder) , nice if manage on/off state in grphically designed symbol this:

square1.on(); /* calling method produces same */ square1.on = true; square1.gotoandstop("onstate");  /* obviously, next method: */ square1.off(); /* produce */ square1.on = false; square1.gotoandstop("offstate"); 

is possible? how create custom on property , custom methods on() , off()? if not possible, else can do? thank you.

use property state , create 2 functions change state , navigate playhead.

also, should extending movieclip create these custom properties... better practice.

class mysquare extends movieclip {     public function on ():void {         this.state = 'on';         this.gotoandstop('onstate');     }     public function off ():void {         // same, off     } 

[tutorial] export actionscript


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -