开发者

flex3: Updating variable

开发者 https://www.devze.com 2023-02-15 03:51 出处:网络
I have a public 开发者_运维知识库variable declared in mxml component. It\'s binded to UI element, so the UI element label, display it\'s changes. Now I need to be able to update the variable inside ot

I have a public 开发者_运维知识库variable declared in mxml component. It's binded to UI element, so the UI element label, display it's changes. Now I need to be able to update the variable inside other separate as3 class, so the label will update itself...

Before this variable was declared in main file of the Application, and I did something like Application.application. = ;

Now I don't understand how to update it... (Because I had to refactor code and move it in separate mxml file)...


If you're using Cairngorm, you can get to the variables in the MXML file by passing the view object into the class:

MyMXMLClass(view).myVariable = newValue;

Really though, you should bind to a variable located somewhere where other source files can get to it easily. Say, create a separate class with a public static var in it that you bind to from both your MXML and your other ActionScript source files.

0

精彩评论

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