I've encountered a scenario where I'm kinda stuck with going around it.
I have 2 classes, Class A and Class B. Class A detects the user input while Class B is a movieclip that has a function in it where it detects the accelerometer input and returns as an animation.
When a user selects the Option menu (Class A input), I'd like Class A to activate a function in Class B where Class B will remove it's accelerometer's eventListener to stop the animation.
I understand the word "static" will come in play, but I threw in a static function in Class B and it appears that whatever movieClip that is the child of Class B becomes undefined.
Is there perhaps another way around this?
P.S: I was thinking about removing the accelerometer's eventlistener to reduce battery consumption on a mobile device and optimize performance.
if the class B instance is created in A, you can reference a public function in B to do whatever you want to that instance of B and its properties (including that movieclip).
if A does not have a reference to B, then you can use a static function in B to reference any other static property of B. if that movieclip in B is not static it will not be referenceable via a static function in B.
hey kglad, 'glad' you can help out .
A currently does not have any reference to B. The movieclip(Class B) is created via drag and drop from library to stage and assigning a class script onto it.
So I guess I'll have to stick with the static method. I'm a little unclear about 'making the movieclip in B' static, how do you do that?
Pardon my lack of actionscript 3 understanding. I'm still in the learning stage lol .
Europe, Middle East and Africa