1 Reply Latest reply on Jul 20, 2009 3:52 PM by Flex harUI

    Binding - the best practices

    christoferek

      Hi All,

       

      I have 2 files:

       

      1. application.mxml where I want to display some variables (properties) from the second file. I will display those variables mainly as debugging infos. I will mainly use <mx:Label> tags.

       

      2. file.as is a class and the properties will have to be displayed in application.mxml. The instances of the class will be created during run time and not at the start.

       


      My question is: How do I do this? I know that binding variables is the solution to this problem. Can you give me a clue and some direction how I start with it? Perhaps some working example will be a good start.

       

      This is common problem I think, but I spent the whole day on studying lots of examples and I am confused now.

       

      Best Regards

       

      Chris

        • 1. Re: Binding - the best practices
          Flex harUI Adobe Employee

          If File.as looks like this:

           

          public class File

          {

               public var name:String = "foo";

          }

           

          You can get it in your app like this:

           

          <mx:Application>

          <mx:Script>

          <![CDATA[

               

               private var aFile:File;

          ]]>

          </mx:Script>

          <mx:Label text="{aFile.name}" />

          </mx:Application>

           

          Add some code to set aFile = new File() and you should see "foo" in the label

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui