topical media & game development
student-game-wakuwaku-game.mx
student-game-wakuwaku-game.mx
[swf]
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:oldwak="com.waku.components.*"
xmlns:wak="*"
layout="absolute">
<mx:Style source="student-game-wakuwaku-com-waku-styles-default.css" />
<wak:student_game_wakuwaku_com_waku_components_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="student-game-wakuwaku-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 : student_game_wakuwaku_com_waku_components_About;
public function menuHandler(event : MenuEvent):void {
if (event.item.@data == "restart")
{
this.removeChild(game);
game = new student_game_wakuwaku_com_waku_components_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 student_game_wakuwaku_com_waku_components_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>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.