开发者

variable to custom component - flex

I'm trying to开发者_如何学Go pass a variable from my main flex application to a custom component I've created, but haven't really figured anything out.

my variable is just a string - public var test:String = "a test";

my custom component is implement in my main application like this - <ns1:finaltest includeIn="FinalTest" x="26" y="19" />

In my custom component 'finaltest' I'd like just to display the variable 'test'. something like this - finalmessage.text = test;


MainApp.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               minWidth="955" minHeight="600" xmlns:local="*"
               >

    <fx:Script>
        <![CDATA[
            [Bindable]
            public var test:String = "a test";
        ]]>
    </fx:Script>

    <local:FinalTest finalMessage="{test}" />
</s:Application>

FinalTest.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" 
         width="400" height="300"
         >


    <fx:Script>
        <![CDATA[
            [Bindable]
            public var finalMessage:String;
        ]]>
    </fx:Script>

    <s:Label text="{finalMessage}" />
</s:Group>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜