Thursday, June 28, 2012

[Action Script] Event Handler Function to Change States in another Component June,2012

Here is my situation. I have an application with an options menu. In its 'Main' component I have created an options menu that includes a drop down menu. This drop down menu allows the user to select between Type 1 and Type 2, which represent two different components (named type1 and type2, respectively) that take turns displaying below the options menu in the 'Main' component, depending on which one is selected.

If I have Type 1 selected then I would also like to have a few checkboxes in the option menu that allow the user to change views within the 'type1' component. I have created 4 different states in the 'type1' component, so I need to figure out how to create an event handler that sits in the 'Main' component but controls the state of the 'type1' component.

Is this possible? I tried to do the following to no avail:

Code: //Method executed when Type 1(A) checkbox is selected in the 'Main' component
//This method and its associated checkbox sit in the 'Main' component
protected function type1AHandler(event:Event):void
{
      type1.currentState = 'A'                                               
}Any ideas how to create an event handler that changes the state of a component that is instantiated in the active component? Thanks!
Event Handler Function to Change States in another Component

Related Post



0 comments: