简体   繁体   中英

binding objects between components flex

i have in my main application:

private var vm:VideoManager;
     protected function init():void{
     vm = new VideoManager();//create a video manager instance
}

and i want to pass the vm instance to another component so i do: <components:LatestVideos left="10" right="10" top="90" bottom="70" vm = "{vm}"/>

and in that component i have

[Bindable]public var vm:VideoManager;

but it does not get a value it is null, what's wrong with that??

thanks in advance!

You have to create your instance of VideoManager in the initialize event instead of creationComplete in your main application.

Looks like your custom component is created before the creationComplete event is fired. That's why you have a null value.

So instead of creationComplete="init()" try initialize="init()"

I juste tested it and it is working. Good luck

您的私有变量不可绑定。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM