2 Replies Latest reply on Mar 31, 2011 2:32 AM by Madhav Subedi

    Passing values from one .mxml file to other

    my_learningflex

      Hi all,

       

      I am a flex newbie, and I have to admit I like flex very much. I have the following question:

      I am trying to make a really simple example, where I have a simple mxml application containing some radiobuttons. the radiobuttons simply change the color of several graphic shapes (circles,etc) on click. I am trying to add a new state (represented as a new mxml module) that contains different shapes. Still, I want to pass the value of the originally created radiobuttons to my new state (aka interface view) so that the new shapes inherit their color according to the radiobuttons value (selected:true || false). I am using flex 4 and in order to load my new interface (module) I use the SWFLoader.

      Any help would be greatly appreciated. Also, if my (above) description doesn't make sense, I can easily paste my code (it's just a few lines anyway).

       

      Thank you.

        • 1. Re: Passing values from one .mxml file to other
          _danada

          I'm not the most experienced flex user, but in other programming languages, each class is usually kept separate and can interact with each other using public functions. You might need to create a function in class B called setColorOfObject(object:object, color:color). Then in class B you can use those values to manipulate objects contained within class B. You would need to call the function contained in class B using class A.

           

          ~dan

          1 person found this helpful
          • 2. Re: Passing values from one .mxml file to other
            Madhav Subedi Level 4

            it is generally done via message passing through events.

             

            you can define custom events ( and messages as their properties ) and fire the event on any user actions.

             

            one mxml ( component ) generates the event and you can define the event handler in your application to call a function in another component.

            1 person found this helpful