Access component properties in MovieClip frames from class file

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,

Dave
dcadlerAsked:
Who is Participating?
 
asaivanConnect With a Mentor Commented:
Each frame is sort of in it's own scope, but to get the values you want to access into that class, you have to pass those values explicitly to the class.  So, somehow, you have to pass values from THAT frame back to the class.  

It would be easier to tell you exactly if you could post your code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.