Dirk,

Works perfectly well - thank you.
The last step to making this completely work is: How about the text color. 
Binding the color property to a public bindable String variable did not do the 
trick:

<mx:Label id="LblSystemMessage" width="450" text="{message}" 
color="{textColor}"/> 

and later

this.TheSystemMessageDialog.textColor="#333333";

does not work.




Ralf 

---------------------------
-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dirk 
Eismann
Sent: Donnerstag, 8. Dezember 2005 14:42
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Part 2: Issues with State and Component creation 
(Flex 2.0 Alpha)

Hi,
 
try to expose the text that should be displayed in the SystemMessage component 
as a public member and let the Label bind to this member, i.e.
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2005/mxml"; xmlns="*">
  <mx:Script>
    <![CDATA[
      [Bindable]
      public var message:String;
    ]]>
  <mx:Script>
  <mx:Label id="TheMessage" text="{message}"/>
</mx:Canvas>

Later you do

  private function addLabel():Void 
  {
    currentState="LabelAdded";
    TheSystemMessage.message = "I have been added";
  }

Dirk.

________________________________

        From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Ralf Rottmann
        Sent: Thursday, December 08, 2005 2:34 PM
        To: flexcoders@yahoogroups.com
        Subject: [flexcoders] Part 2: Issues with State and Component creation 
(Flex 2.0 Alpha)
        
        

        Here is some code which illustrates the issue:

         

        1. The Component (File SystemMessage.mxml):

         

        <?xml version="1.0" encoding="utf-8"?>

        <mx:Canvas xmlns:mx="http://www.macromedia.com/2005/mxml"; xmlns="*">

              <mx:Label id="TheMessage"/>

        </mx:Canvas>

         

         

        2. The main application (File StatePlayground.mxml):

         

        <?xml version="1.0" encoding="utf-8"?>

        <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"; 
xmlns:local="*">

              <mx:Script>

                    <![CDATA[

                          private function addLabel():Void

                          {

                                currentState="LabelAdded";

                                TheSystemMessage.TheMessage.text = "I have been 
added";

                          }

                          private function removeLabel():Void

                          {

                                currentState="";

                          }                 

                    ]]>

              </mx:Script>

              <mx:Canvas width="100%" height="100%">

                    <mx:VBox>

                          <mx:Button label="Add label" click="addLabel()"/>

                          <mx:Button label="Remove label" 
click="removeLabel()"/>           

                    </mx:VBox>              

              </mx:Canvas>

              <mx:states>

                    <mx:State name="LabelAdded">

                          <mx:AddChild position="firstChild">

                                <local:SystemMessage id="TheSystemMessage"/>

                          </mx:AddChild>                

                    </mx:State>

              </mx:states>

        </mx:Application>

         

         

        รจ Issue: First click on "Add label" Buttonf fails with Erorr #1009: 
Null has no properties. If you dismiss the error subsequent clicks work.

         

        Ralf 

         



        --
        Flexcoders Mailing List
        FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
        Search Archives: 
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
        
        
        
________________________________

        YAHOO! GROUPS LINKS 


                        *        Visit your group "flexcoders 
<http://groups.yahoo.com/group/flexcoders> " on the web.
                  
        *        To unsubscribe from this group, send an email to:
                 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
                  
        *        Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service <http://docs.yahoo.com/info/terms/> . 


________________________________





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to