1 Reply Latest reply on Jan 10, 2009 12:56 PM by Gregory Lafrance

    Change a object property in an application through a seperate class

    pabera
      hey guys.. i probably got a simple problem, I just can't find an answer...

      this is the case i am talking about

      I got an application with two labels in it
      quote:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal">
      <mx:Script>
      <![CDATA[
      import foo.Bar;
      public var copy:Bar = new Bar();
      ]]>
      </mx:Script>

      <mx:Label id="myLabel1" text="Hello"/>
      <mx:Label id="myLabel2" />
      </mx:Application>



      So in a seperated class file I got the class "Bar" within the namspace "foo".. thats why i importet that in my application
      the class looks like this
      quote:

      package foo
      {
      public class Bar
      {
      public function Bar()
      {
      // -> at this point i would like to read the text of label1 and set it as the text of label2.
      }
      }
      }


      as I have written in the constructor already.. i would like to get the text from label1 and set it as the text of label2, without passing the labels objects wo the cunstructor..

      quote:

      Application.application.label2.text = Application.application.label1.text;

      this doesn't work, is there any possibility to do that?

      greets patrick