Okay, a LOT of the problems I’ve been having resulted from me not understanding scope, so now I’ve got some scope questions for ya to help clarify.
HOW can I have a value shared between multiple classes? For example.
public var test:int = 3;
This works fine for the “main” class, but in the “animal” class, it can’t access this variable. So if I wanted to set a rate of movement for an object, say animal, and I want to change it later in a different function, well, how? Any good guides to passing variables between functions and classes that are easy to understand?
HOW can I pass values to ENTER_FRAME events, err…any events really. Example.
public class animal extends MovieClip{
public function animal(){
trace('crazy stuff happening');
this.addEventListener(Event.ENTER_FRAME, aniMove)
}
public function aniMove(evt:Event){
trace('moving')
this.y ++;
}
}
}
Lets say I wanted to pass the Y value from the main class and not from within the animal function.