开发者

flex title window

Despite adding:

source="myScript.as" (that basically feeds the main.mxml file)

to my TitleWindow compone开发者_JAVA百科nt MXML file (which I instantiate from the main.mxml file) the variables defined in myScript.as appear to be null hence I can't populate my text fields in the title window, even though those variables work fine in the main.mxml.

Can anybody please help?

Cheers


When you do

<fx:Script source="SomeScript.as" />

It is the same as actually including the text directly into your class. You're confusing your OOP concepts. Just because you're including the script in the TitleWindow doesn't mean that the properties will be magically copied over. You will have properties in your TitleWindow but those properties will be null since the Main.mxml instance is different than your TitleWindow.

To solve this, you should create a component of your TitleWindow that accepts data (the data you want it to know about) by using a getter/setter named 'dataProvider' (which is the standard). From there, you just need to do this from your Main.mxml:

<YourTitleWindowComponent dataProvider="{dataYouWantCopiedOver}" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜