Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 719
  • Last Modified:

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
0
dcadler
Asked:
dcadler
1 Solution
 
asaivanCommented:
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now