Access component properties in MovieClip frames from class file

Posted on 2008-11-05
Last Modified: 2013-11-12
I have a flash .fla called ZBreak.fla. I have a document class file called 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 file called startZBreak, which kicks off the game.

Within the 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 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 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 file?

Thanks in advance,

Question by:dcadler
    1 Comment
    LVL 9

    Accepted Solution

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
    Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
    The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now