Flash Player 10 (astro) を触ってみた。

http://blog.everythingflex.com/2008/05/20/using-flash-player-10-within-flex-builder/
辺りを参考に、FlexBuilder3にFlexSDK 3.0.1.1739 を設定して、3D表示をさわさわ。

作ったものをさらしておく。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*"
	creationComplete="creationCompleteThis()">
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			
			use namespace astro;
			
			[Bindable]
			private var guriguriStopped:Boolean = true;
						
			private function guriguriStart():void {
				win.addEventListener(Event.ENTER_FRAME, guriguriWindow);
				guriguriStopped = false;
			}
			
			private function guriguriStop():void {
				win.removeEventListener(Event.ENTER_FRAME, guriguriWindow);
				guriguriStopped = true;
			}

			private function guriguriWindow(e:Event):void {
				win.astro::rotationY += 1;
				win.astro::rotationX += 1;
			}
			
			private function doClick():void {
				Alert.show(textArea.text);
			}
			
			private function creationCompleteThis():void {
				win.addEventListener(Event.ENTER_FRAME, updateAstroLabel);	
			}
			
			private function updateAstroLabel(e:Event):void {
				astroZLabel.text = "" + win.astro::z;
				astroRotXLabel.text = "" + win.astro::rotationX;
				astroRotYLabel.text = "" + win.astro::rotationY;
			}
			
			private function  doPlusZ():void { win.astro::z += 10; }
			private function  doResetZ():void { win.astro::z = 0; }
			private function  doMinusZ():void { win.astro::z -= 10; }
			
			private function  doPlusRotX():void { win.astro::rotationX += 10; }
			private function  doResetRotX():void { win.astro::rotationX = 0; }
			private function  doMinusRotX():void { win.astro::rotationX -= 10; }

			private function  doPlusRotY():void { win.astro::rotationY += 10; }
			private function  doResetRotY():void { win.astro::rotationY = 0; }
			private function  doMinusRotY():void { win.astro::rotationY -= 10; }
		]]>
	</mx:Script>
	
	<mx:VBox top="0" right="0" left="0">
		<mx:HBox width="100%" horizontalAlign="center">
			<mx:Label text="astro::z"/>
			<mx:Button label="+10" click="doPlusZ()"/>
			<mx:Button label="0" click="doResetZ()"/>
			<mx:Button label="-10" click="doMinusZ()"/>
			<mx:Spacer width="20"/>
			<mx:Label text="astro::rotationX"/>
			<mx:Button label="+10" click="doPlusRotX()"/>
			<mx:Button label="0" click="doResetRotX()"/>
			<mx:Button label="-10" click="doMinusRotX()"/>
			<mx:Spacer width="20"/>
			<mx:Label text="astro::rotationY"/>
			<mx:Button label="+10" click="doPlusRotY()"/>
			<mx:Button label="0" click="doResetRotY()"/>
			<mx:Button label="-10" click="doMinusRotY()"/>
			<mx:Spacer width="20"/>
			<mx:Label text="GuriGuri"/>
			<mx:Button label="Start" click="guriguriStart()" id="guriStartButton" enabled="{guriguriStopped}"/>
			<mx:Button label="Stop" click="guriguriStop()" id="guriStopButton" enabled="{!guriguriStopped}"/>
		</mx:HBox>
		<mx:HBox>
			<mx:Label text="z:"/>
			<mx:Label id="astroZLabel"/>
			<mx:Label text="rotationX:"/>
			<mx:Label id="astroRotXLabel"/>
			<mx:Label text="rotationY:"/>
			<mx:Label id="astroRotYLabel"/>
		</mx:HBox>
	</mx:VBox>
	
	<mx:TitleWindow id="win" verticalCenter="0" horizontalCenter="0" width="300" height="300" layout="absolute">
		<mx:VBox height="100%" width="100%">
			<mx:TextInput id="textArea" text="ほげほげほげ"/>
			<mx:Button label="押してね" click="doClick()"/> 
		</mx:VBox>
	</mx:TitleWindow>
	
</mx:Application>

上記を適当な名前で保存して、以下の astro.as を同じ階層に置いてコンパイルだ。

package {
    public namespace astro = "http://www.adobe.com/2008/actionscript/Flash10/";
}