我正在使用Swiz框架,我正在尝试使用可绑定属性更新我的viewstack的selectedIndex。它到达我的事件处理程序,它更新可绑定变量,但主应用程序文件的viewstack从未实现它。可能是什么问题?
THX
-Mike
================================
<mx:Script>
<![CDATA[
import reg.model.ApplicationViewModel;
import beyaz.reg.swiz.SwizBeans;
import org.swizframework.Swiz;
[Autowire(bean="applicationViewModel")]
[Bindable]
public var applicationViewModel:ApplicationViewModel;
private function preInitialize():void {
Swiz.loadBeans( [ SwizBeans ] );
}
]]>
</mx:Script>
<mx:ViewStack id="theViewstack" **selectedIndex=" {applicationViewModel.mainViewIndex}"** width="100%" height="100%">
<prescreen:Prescreen id="prescreenView"/>
<login:Login id="loginView"/>
<profile:Profile id="profileView"/>
</mx:ViewStack>
=================================
包com.reg.model { 公共类ApplicationViewModel { public static const PRESCREEN_VIEW:int = 0; public static const LOGIN_VIEW:int = 1; public static const PRSNL_INFO_VIEW:int = 2;
[Bindable]
public var message:String = "";
[Bindable]
public var mainViewIndex:int = PRESCREEN_VIEW;
}
}
===========================
包com.reg.controller {
import com.reg.model.ApplicationViewModel;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.DynamicEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.core.Application;
import org.swizframework.Swiz;
import org.swizframework.controller.AbstractController;
public class PrescreenController// extends AbstractController
{
public static const START_REGISTRATION:String = "startReg";
[Autowire(bean="applicationViewModel")]
[Bindable]
public var applicationViewModel:ApplicationViewModel;
[Mediate(event="startReg")]
public function startReg():void
{
//CODE GETS TO HERE!
applicationViewModel.mainViewIndex = ApplicationViewModel.PRSNL_INFO_VIEW;
}
}
}
答案 0 :(得分:0)
上周我对这个问题有所了解。
将[Bindable]
标记放在其他标记之前。出于某种原因,Flex编译器不会在适当的PropertyChangeEvent
调度中折叠,除非您先放置[Bindable]
标记。