Access component properties in MovieClip frames from class file
Posted on 2008-11-05
I have a flash .fla called ZBreak.fla. I have a document class file called ZBreak.as that is linked to the ZBrick.fla. The .fla has the following frames; intro, story, options, play and gameover.
I have components, such as RadioButtons and Sliders in the Options frame. The Play frame has Dynamic text boxes for score, kills, etc. The Play frame also has actionscript code that calls a function in the ZBreak.as file called startZBreak, which kicks off the game.
Within the ZBreak.as file, I can easily access and update the .text property of the Dynamic text boxes on the Play frame by simply referencing something like score_Text.text = 0;
However, from within the ZBreak.as class file, I can not access the properties of the components on the options frame, even though it is in the same MovieClip, just a different frame than the one that called the startZBreak function.
For example, on the options frame, I have a RadioButton group with 3 RadioButtons (level1_RadioButton, level2_RadioButton and level3_RadioButton) that I want the user to use to select the difficulty level of the game.
Within the ZBreak.as file, startZBreak function, I would think that I should be able to do something like...
var difficulty:Number = level1_RadioButton.value;
But in doing so, I get a null reference error. Is each frame its own scope? If so, how do I reference it deom the ZBreak.as file?
Thanks in advance,