hi im new on as3 and its make me so frustated since so many changes from as2. i have problem when i want to change variable value from class file, here is the detail.
on the root timeline frame 2, i initialized var like below
stop();
var gameStat;
gameStat = "stop";
then i attached penguin movie clip to the stage, and i make class file called "penguin.as"
//untuk hero penguin
package {
import flash.display.MovieClip;
import flash.events.Event;
public class penguin extends MovieClip {
var rootref:Object = root;//mendefinisikan root dengan rootref
public function penguin() {
rootref.gameStat = "play";//change var value to play
addEventListener(Event.ENTER_FRAME,on_enter_frame);//tmbhkn enterFrame function
}//eof penguin()
private function on_enter_frame(e:Event) {
trace(rootref.gameStat);//<- test the variable here
//trace(this.parent.parent.parent.gameStat);
}
}//eof class
}
i trace gameStat var in on_enter_frame function, but it still give me "stop" result not "play". any help how to change the "gameStat" value??