<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:wak="com.waku.components.*" layout="absolute" viewSourceURL="srcview/index.html"> <mx:Style source="com/waku/styles/default.css" /> <wak:Game id="game" /> <mx:ApplicationControlBar > <mx:HBox width="100%"> <mx:MenuBar id="myMenuBar" labelField="@label" itemClick="menuHandler(event)" > <mx:XMLList> <menuitem label="Mi Granja"> <menuitem label="Restart game" data="restart"/> <menuitem label="About Mi Granja" data="about"/> </menuitem> <menuitem label="Sound"> <menuitem label="ON" data="unmute" type="radio" toggled="true" groupName="one" /> <menuitem label="OFF" data="mute" type="radio" groupName="one" /> </menuitem> <menuitem label="Language"> <menuitem label="English" type="radio" toggled="true" groupName="two"/> <menuitem label="EspaƱol" enabled="false" /> <menuitem label="French" enabled="false"/> <menuitem label="German" enabled="false"/> </menuitem> </mx:XMLList> </mx:MenuBar> <mx:Spacer width="80%"/> <mx:Spacer width="100%"/> </mx:HBox> </mx:ApplicationControlBar> <mx:Image horizontalCenter="0" source="com/waku/images/migranja.png" y="5"/> <mx:Script> <![CDATA[ import mx.events.CloseEvent; import com.waku.components.About; import mx.events.MenuEvent; import flash.events.MouseEvent; [bindable] public var about : About; public function menuHandler(event : MenuEvent):void { if (event.item.@data == "restart") { this.removeChild(game); game = new Game(); this.addChildAt(game,0); } if (event.item.@data == "about") { openAbout(); } if (event.item.@data == "mute") { game.muteSound(true); } if (event.item.@data == "unmute") { game.muteSound(false); } } public function aboutClickHandler (event: MouseEvent) : void { openAbout(); } private function openAbout():void { if (!about) { about = new About(); about.addEventListener(CloseEvent.CLOSE, closeButtonHandler); this.addChild(about); } about.visible=true; } public function closeButtonHandler(event: CloseEvent):void { about.visible=false; } ]]> </mx:Script> </mx:Application>