3 Replies Latest reply on Oct 13, 2009 2:05 AM by Rahul Kamra

    how can a label get its text value from an actionscript function??

    IptamenosOllandos

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
      
      <mx:Script>
           <![CDATA[
                import mx.controls.Text;
                 import mx.controls.Alert;
                 import mx.collections.ArrayCollection;
                 
              
               private function showPage():String{
                      label1Text="test";
                      return label1Text;
      
                    
                  }
                  
                    
         
                 
           ]]>
      </mx:Script>
      
      
      
                
                <mx:Label x="210" y="113" text="{showPage()}" width="216" height="20" id="label1"/>
           
      </mx:Application>
      

      Im trying to give to my label its text value from a function when it is loading.(i can do it with click or rollover trigger event but i want to get it automatically upon its loading without the user has to do something) Cause every time i want it to have different value. how can i pass the return string of a function to the initial text attribute of a label??