浏览 5979 次
锁定老帖子 主题:web界面框架的设计--主模块的设计
该帖已经被评为隐藏帖
|
|
---|---|
作者 | 正文 |
发表时间:2010-02-28
最后修改:2010-02-28
主模块主要包括一个top菜单的,一个树形菜单,一个用来显示主要功能的中心区的模块。代码: <?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" backgroundSize="100%" creationComplete="init()" xmlns:ns1="components.*"> <mx:Script> <![CDATA[ import MyEvent.TopEvent; import MyEvent.LeftTreeEvent; import mx.events.*; import Modules.*; import mx.controls.Alert; import mx.events.ItemClickEvent; import mx.modules.ModuleManager; import mx.modules.IModuleInfo; public var module:IModuleInfo; public var fId:Number; private var hreflink:String; private var treeXml:XML; public function init():void { } //点击顶菜单改变左边树形菜单 public function clickTopMenu(event:Event):void { var topEvent:TopEvent = event as TopEvent; treeXml=topEvent.treeXml; treeMenu.tree.dataProvider=treeXml; treeMenu.tree.callLater(expandTree); } //树行自动展开 private function expandTree():void{ treeMenu.tree.expandChildrenOf(treeXml , true); } //点击树触发事件 public function clickTree(event:Event):void { var leftTreeEvent:LeftTreeEvent = event as LeftTreeEvent; hreflink = leftTreeEvent.hreflink; fId = leftTreeEvent.functionId; if(hreflink != "" && hreflink != null){ /* centerCanvas.visible = false; */ var link:String ="Modules/" + hreflink +".swf"; module = ModuleManager.getModule(link); if(module != null){ centerModule.unloadModule(); centerModule.loadModule(link); centerModule.applicationDomain=ApplicationDomain.currentDomain; } } } ]]> </mx:Script> <mx:Canvas x="0" y="0" width="100%" height="100%" id="mainCanvas" backgroundSize="100%"> <mx:VBox x="0" y="0" width="100%" height="100%" backgroundSize="100%"> <mx:HBox width="100%" height="60" borderStyle="solid"> <ns1:TopPage height="100%" width="100%" id="topPage" topOpEvent="clickTopMenu(event)"> </ns1:TopPage> </mx:HBox> <mx:HBox name="centerHBox" width="100%" height="100%" id="centerHBox" borderStyle="none"> <mx:Canvas width="169" height="100%" id="menu_Canvas"> <ns1:MenuPage x="0" y="0" width="100%" height="100%" id="treeMenu" leftTreeEvent="clickTree(event)"> </ns1:MenuPage> </mx:Canvas> <mx:VBox width="100%" height="100%"> <mx:Canvas width="100%" height="100%" id="centerCanvas"> <mx:ModuleLoader id="centerModule" width="100%" height="100%"> </mx:ModuleLoader> </mx:Canvas> </mx:VBox> </mx:HBox> </mx:VBox> </mx:Canvas> </mx:Module>
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2010-03-03
没能跑起来,少了好些view没放上来...
|
|
返回顶楼 | |