多模块ModuleLoader思路演变

版本一:

<fx:Script>
<![CDATA[

private function init():void
{
setPanel("home");
}

public function setPanel(type:String):void
{
switch(type){

case "home":
this.myViewStack.selectedChild=home;
this.title="首页";
break;
case "bio":
this.myViewStack.selectedChild=bio;
this.title="个人档";
break;
case "log":
this.myViewStack.selectedChild=log;
this.title="日志";
break;
case "music":
this.myViewStack.selectedChild=music;
this.title="音乐盒";
break;
case "album":
this.myViewStack.selectedChild=photo;
this.title="相册";
break;
case "leavewords":
this.myViewStack.selectedChild=leaveWords;
this.title="留言板";
break;
case "game":
this.myViewStack.selectedChild=game;
this.title="小游戏";
break;
default:
break;
}

}
]]>
</fx:Script>
<mx:ViewStack id="myViewStack" width="100%" height="100%" >
<mx:Box id="home" width="100%" height="100%" verticalScrollPolicy="on" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModuleHome.swf"/>
</mx:Box>

<mx:Box id="bio" width="100%" height="100%" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModuleBio.swf" />
</mx:Box>

<mx:Box id="log" width="100%" height="100%" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModuleLog.swf"/>
</mx:Box>

<mx:Box id="music" width="100%" height="100%" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModuleMusic.swf" />
</mx:Box>

<mx:Box id="photo" width="100%" height="100%" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModulePhoto.swf" />
</mx:Box>

<mx:Box id="leaveWords" width="100%" height="100%" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModuleLeaveWords.swf"/>
</mx:Box>

<mx:Box id="game" width="100%" height="100%" horizontalScrollPolicy="off">
<module:XModuleLoader url="com/dreamer/module/ModuleGame.swf"/>
</mx:Box>
</mx:ViewStack>


版本二:

<fx:Script>
<![CDATA[

private function init():void
{
setPanel("home");
}

public function setPanel(type:String):void
{
this.currentState = type;
}
]]>
</fx:Script>

<fx:Declarations>
<s:State name="home" />
<s:State name="bio" />
<s:State name="log" />
<s:State name="music" />
<s:State name="album" />
<s:State name="leavewords" />
<s:State name="game" />
</fx:Declarations>

<module:XModuleLoader url="com/dreamer/module/ModuleHome.swf" includeIn="home" verticalScrollPolicy="on" horizontalScrollPolicy="off"/>
<module:XModuleLoader url="com/dreamer/module/ModuleBio.swf" includeIn="bio" horizontalScrollPolicy="off"/>
<module:XModuleLoader url="com/dreamer/module/ModuleLog.swf" includeIn="log" horizontalScrollPolicy="off"/>
<module:XModuleLoader url="com/dreamer/module/ModuleMusic.swf" includeIn="music" horizontalScrollPolicy="off"/>
<module:XModuleLoader url="com/dreamer/module/ModulePhoto.swf" includeIn="album" horizontalScrollPolicy="off"/>
<module:XModuleLoader url="com/dreamer/module/ModuleLeaveWords.swf" includeIn="leavewords" horizontalScrollPolicy="off"/>
<module:XModuleLoader url="com/dreamer/module/ModuleGame.swf" includeIn="game" horizontalScrollPolicy="off"/>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值