suganya's Blog

Just another WordPress.com weblog

Sample program

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute”>
<mx:Script>
<![CDATA[
import mx.core.Application;
import mx.controls.SWFLoader;
private var gameswf:SWFLoader;
private var can:Canvas;
private var back_btn:Button;
public function onPlay_game(eve:MouseEvent):void
{
can=new Canvas();
back_btn=new Button();
gameswf=new SWFLoader();
gameswf.source="game.swf";
gameswf.width=500;
gameswf.height=400;
back_btn.width=70;
back_btn.height=30;
back_btn.x=175;
back_btn.y=330;
back_btn.label="Back";
back_btn.addEventListener(MouseEvent.CLICK,onPlay_back);
game_play.visible=false;
addChild(can);
can.addChild(gameswf);
can.addChild(back_btn);
}
public function onPlay_back(eve:MouseEvent):void

{
can.removeChild(gameswf);
can.removeChild(back_btn);
viewstack1.selectedChild=games;
}
]]>
</mx:Script>
<mx:ApplicationControlBar x=”93″ y=”59″ width=”411″ height=”5%”>
<mx:Button label=”Home” click=”viewstack1.selectedChild=home”/>
<mx:Button label=”About Us” click=”viewstack1.selectedChild=aboutus”/>
<mx:Button label=”Gallery” click=”viewstack1.selectedChild=gallery”/>
<mx:Button label=”Games” click=”viewstack1.selectedChild=games”/>
<mx:Button label=”ContactUs” click=”viewstack1.selectedChild=contactus”/>
</mx:ApplicationControlBar>
<mx:ViewStack x=”13″ y=”134″ id=”viewstack1″ width=”569″ height=”80%”>
<mx:Canvas label=”Home” width=”100%” height=”100%” id=”home” color=”#D9EDF1″>
<mx:ColorPicker x=”175″ y=”205″/>

</mx:Canvas>
<mx:Canvas label=”Aboutus” width=”100%” height=”100%” id=”aboutus” color=”#49CCE8″>
<mx:DataGrid x=”129″ y=”167″>
<mx:columns>
<mx:DataGridColumn headerText=”Column 1″ dataField=”col1″/>
<mx:DataGridColumn headerText=”Column 2″ dataField=”col2″/>
<mx:DataGridColumn headerText=”Column 3″ dataField=”col3″/>
</mx:columns>
</mx:DataGrid>

</mx:Canvas>
<mx:Canvas label=”Gallery” width=”100%” height=”100%” id=”gallery” color=”#BED32E”>
<mx:DateChooser x=”182″ y=”219″/>
</mx:Canvas>
<mx:Canvas label=”Games” width=”100%” height=”100%” id=”games” verticalScrollPolicy=”off”>
<mx:Image id=”game1″ x=”33″ y=”74″ width=”158″ height=”134″ source=”Images/image2.jpeg” click=”viewstack1.selectedChild=imagecan”/>
<mx:Image id=”game2″ x=”23″ y=”433″ width=”158″ height=”134″ source=”Images/image3.jpeg”/>
<mx:Image id=”game3″ x=”223.5″ y=”266″ width=”158″ height=”134″ source=”Images/image4.jpeg”/>
<mx:Image id=”game4″ x=”223.5″ y=”433″ width=”158″ height=”134″ source=”Images/image5.jpg”/>
<mx:Image id=”game5″ x=”23″ y=”255″ width=”158″ height=”134″ source=”Images/image6.jpg”/>
<mx:Image id=”game6″ x=”213″ y=”74″ width=”158″ height=”134″ source=”Images/image1.jpeg”/>
</mx:Canvas>
<mx:Canvas label=”ContactUs” width=”100%” height=”100%” id=”contactus” color=”#6E40B4″>
<mx:ProgressBar x=”212″ y=”198″/>
</mx:Canvas>
<mx:Canvas id=”imagecan” name=”imgcan” width=”700″ height=”500″
horizontalCenter=”0″ verticalCenter=”0″
verticalScrollPolicy=”off”>
<mx:Text x=”168″ y=”10″ text=”Gamedescription” width=”239″ height=”22″ fontWeight=”bold” fontSize=”14″/>
<mx:Button id=”game_play” x=”168″ y=”317″ label=”Play Game” click=”onPlay_game(event)” visible=”true”/>
<mx:Text x=”91″ y=”54″ text=”Identify the required color of the balloon correctly &#xa;and fill it with suitable color.To fill the color, select the color&#xa;from the palette and click on the balloon to fill color. You will &#xa;get bonus points by giving color to the parachute. &#xa;Reach the targetĀ  in each level within given duration&#xa;and play further levels.&#xa;&#xa;Game control.&#xa;Use mouse to interact.&#xa;To bring the game to pause, click on the pause button.&#xa;To mute the sound, click the mute button.” width=”348″ height=”177″ textAlign=”left” fontWeight=”bold” fontSize=”10″/>
</mx:Canvas>

</mx:ViewStack>
</mx:Application>

November 21, 2009 Posted by | Drupalwithflex | Leave a Comment

   

Follow

Get every new post delivered to your Inbox.