flash on 2010-1-12

by mirkofresa
♥0 | Line 185 | Modified 2010-01-12 19:24:19 | MIT License
play

ActionScript3 source code

/**
 * Copyright mirkofresa ( http://wonderfl.net/user/mirkofresa )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/eHGH
 */

<?xml version="1.0" encoding="utf-8"?>
<!-- forked from mirkofresa's forked from: Flex+ReflectionView -->
<!-- forked from masaya3's Flex+ReflectionView -->
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    creationComplete="onCreationComplete()"
    frameRate="15"
    layout="absolute">

    <mx:Script><![CDATA[
			
			import flash.events.KeyboardEvent;
			import mx.controls.Alert;
			import mx.events.CloseEvent;
			 
			import org.papervision3d.events.InteractiveScene3DEvent;
			import org.papervision3d.materials.MovieMaterial;
			import org.papervision3d.materials.utils.MaterialsList;
			import org.papervision3d.materials.ColorMaterial;
			import org.papervision3d.objects.primitives.Cube;
			import org.papervision3d.objects.DisplayObject3D;
			import org.papervision3d.core.effects.view.ReflectionView;
			import org.papervision3d.materials.special.CompositeMaterial;
			import org.papervision3d.objects.primitives.Plane;
			
			
			
		//コンテナ
			private var container:Sprite;
			//鏡面反射用
			private var reflectionView:ReflectionView;
			//ルート用
			private var rootNode:DisplayObject3D;
			//立方体
			private var cube:Cube;
			//レンダリングする?しないフラグ
			private var isRender:Boolean = true;
			
			/**
			 * 初期イベント
			 */
			 
			private function onCreationComplete():void
			{
				container = new Sprite();
				//画面に登録
				rawChildren.addChild(container);
				
				//ReflectionViewクラス作成
				reflectionView = new ReflectionView(baseCanvas.width, baseCanvas.height, true, true);
				// 反射面の高さを設定します
				reflectionView.surfaceHeight = 0;
				//反射面へのフィルター
				//reflectionView.viewportReflection.filters = ;
				//反射面へのアルファ値
				reflectionView.viewportReflection.alpha = .25;
				
				//コンテナに登録
				container.addChild(reflectionView);
			
				//カメラの位置設定
				reflectionView.camera.zoom=30;
				reflectionView.camera.focus = 20;
				reflectionView.camera.y = 700;
			
			
				
				reflectionView.camera.target = DisplayObject3D.ZERO;
				
				//rootNodeの作成
				rootNode=reflectionView.scene.addChild(new DisplayObject3D("rootNode"));

				// 地面用マテリアルの作成
				var compMat:CompositeMaterial = new CompositeMaterial();
				compMat.addMaterial(new ColorMaterial(0xffffff, 0.1)); 
				 
				var plane:Plane = new Plane(compMat, 3000, 3000, 6, 6); 
				plane.pitch(90) 				
				rootNode.addChild(plane);
				
				//ログインボックスのボックス作成
				var moveMaterial1:MovieMaterial = new MovieMaterial(visualsWindow, true, true, true);
				moveMaterial1.interactive=true;
				var moveMaterial2:MovieMaterial = new MovieMaterial(bioWindow, true, true, true);
				moveMaterial2.interactive=true;
				var moveMaterial3:MovieMaterial = new MovieMaterial(musicWindow, true, true, true);
				moveMaterial3.interactive=true;
				var moveMaterial4:MovieMaterial = new MovieMaterial(programmingWindow, true, true, true);
				moveMaterial4.interactive=true;
				var moveMaterial5:MovieMaterial = new MovieMaterial(contactsWindow, true, true, true);
				moveMaterial5.interactive=true;
				var materialList:MaterialsList = new MaterialsList({top:moveMaterial5, left:moveMaterial3, front:moveMaterial4, right:moveMaterial1, back:moveMaterial2});
				cube = new Cube(materialList, 290, 290, 290);
				cube.y = 100;
				rootNode.addChild(cube, "cube");

				//フレームイベント登録
				addEventListener(Event.ENTER_FRAME, onEnterFrame);
			}
			
			/**
			 * フレームイベント
			 * @param	e
			 */
			private function onEnterFrame(e:Event):void
			{
				//レンダリングしない場合は、以下を実行しない
				if(!isRender){
					return;
				}				
				
				//立方体を横回転
				cube.rotationY += 0.5;
				
				//レンダリング
				reflectionView.singleRender();
			}
			
			/**
			 * ログインボタンクリック時のイベント
			 * @param	event
			 */
			private function onIvisualsClick(event:MouseEvent):void
			{
								Alert.show(
"Innovazione \nnella comunicazione visiva, \nla grafica e le \nproduzioni multimediali.\n\nInnovation \nin visual communication, \ngraphics \nand multimedia production.",
"visuals", Alert.OK, this); 
			
			}
			private function onIcontactsClick(event:MouseEvent):void
			
			{Alert.okLabel = "HOME";
								Alert.show(
"Chi contattare \rper ulteriori informazioni\rsu questo sito.\n\nWhom to contact \rfor further information\rabout this site.",
"contacts", Alert.OK, this); 
			
			}
                        private function onImusicClick(event:MouseEvent):void
			{Alert.okLabel = "HOME"
								Alert.show(
"Piu\' di venti anni \ntra passione \ne sperimentazione, \ncome ascoltatore, esecutore \ne compositore. \n\nOver twenty years \nof passion \nand experimentation, \ras a listener, performer \nand composer.",
"music", Alert.OK, this); 
			
			}
			private function onIprogrammingClick(event:MouseEvent):void
			{Alert.okLabel = "HOME";
								Alert.show(
"In questa pagina,\n progetti, realizzazioni e idee \nnel campo dell\'informatica \nOpenSource.\n\nIn this page, \nprojects, achievements \nand ideas \nin OpenSource computing.",
"programming", Alert.OK, this); 
			
			}
		        private function onIbioClick(event:MouseEvent):void
			{
								Alert.show(
"Una breve biografia \ndi Roberto Nocci, \nl\'autore di questo sito.\n\nA brief biography \nof Roberto Nocci, \nthe author of this site.",
"bio", Alert.OK, this); 
			
			}
			/**
			 * キャンセルボタンクリック時のイベント
			 * @param	event
			 */	
			private function onCancelClick(event:MouseEvent):void
			{
				navigateToURL(
            new URLRequest('http://www.adobe.com/go/gn_contact'));
            
            
			}
			private function onContactsClick(event:MouseEvent):void
			{isRender = false;
				navigateToURL(
            new URLRequest('http://sites.google.com/site/phresacorp/contact'));
            
            
			}
			private function onMusicClick(event:MouseEvent):void
			{isRender = false;
				navigateToURL(
            new URLRequest('http://sites.google.com/site/phresacorp/music'));
            
            
			}
			private function onBioClick(event:MouseEvent):void
			{isRender = false;
				navigateToURL(
            new URLRequest('http://sites.google.com/site/phresacorp/bio'));
            
            
			}
			private function onProgrammingClick(event:MouseEvent):void
			{isRender = false;
				navigateToURL(
            new URLRequest('http://sites.google.com/site/phresacorp/programming'));
            
            
			}
			private function onVisualsClick(event:MouseEvent):void
			{isRender = false;
				navigateToURL(
            new URLRequest('http://sites.google.com/site/phresacorp/visual'));
            
            
			}
			
			/**
			 * AlertのOKボタン押下時
			 * @param	event
			 */
			private function onAlertClick(event:CloseEvent):void
			{
				isRender = true;
			}
			
			/**
			 * ログインボタンでキー押下時のイベント
			 * @param	event
			 */	
			private function onLoginKeyDown(event:KeyboardEvent):void
			{
				}				
			}
			
			/**
			 * キャンセルボタンでキー押下時のイベント
			 * @param	event
			 */
			private function onCancelKeyDown(event:KeyboardEvent):void
			{	isRender = false				
				}
			}
			
		]]></mx:Script>

    <!-- ログインボックス -->
    
    <mx:Canvas id="visualsWindow" backgroundColor="#4b2273" width="400" height="400">
        <mx:Button label="info" color="0xf4b2273" fillColors="[0xffffff, 0xcccccc]"
fontSize="48" cornerRadius="60" x="25" y="25" width="120" height="120" click="onIvisualsClick(event)" keyDown="onLoginKeyDown(event)" />
        <mx:Button label=" go " color="0xf4b2273" fontSize="48" cornerRadius="60" x="260" y="260" width="120" height="120"  click="onVisualsClick(event)" keyDown="onCancelKeyDown(event)" />
   <mx:Text right="94" y="150" fontSize="64" color="0xffffff"
                        text="visuals"
                         />
    </mx:Canvas>
    <mx:Canvas id="contactsWindow" backgroundColor="0x555555" width="400" height="400">
        <mx:Button label="info" color="0xf555555" fillColors="[0xffffff, 0xcccccc]"
fontSize="48" cornerRadius="60" x="25" y="25" width="120" height="120" click="onIcontactsClick(event)" keyDown="onLoginKeyDown(event)" />
        <mx:Button label=" go " color="0xf555555" fontSize="48" cornerRadius="60" x="260" y="260" width="120" height="120"  click="onContactsClick(event)" keyDown="onCancelKeyDown(event)" />
   <mx:Text right="80" y="155" fontSize="64" color="0xffffff"
                        text="contacts"
                         />
                                                   </mx:Canvas>
	<mx:Canvas id="musicWindow" backgroundColor="#4b7322" width="400" height="400">
        <mx:Button label="info" color="0xf4b7322" fillColors="[0xffffff, 0xcccccc]"
fontSize="48" cornerRadius="60" x="25" y="25" width="120" height="120" click="onImusicClick(event)" keyDown="onLoginKeyDown(event)" />
        <mx:Button label=" go " color="0xf4b7322" fontSize="48" cornerRadius="60" x="260" y="260" width="120" height="120"  click="onMusicClick(event)" keyDown="onCancelKeyDown(event)" />
      <mx:Text right="108" y="150" fontSize="64" color="0xffffff"
                        text="music"
                         />
                         </mx:Canvas>
    <mx:Canvas id="bioWindow" backgroundColor="#732222" width="400" height="400">
       <mx:Button label="info" color="0xf732222" fillColors="[0xffffff, 0xcccccc]"
fontSize="48" cornerRadius="60" x="25" y="25" width="120" height="120" click="onIbioClick(event)" keyDown="onLoginKeyDown(event)" />
        <mx:Button label=" go " color="0xf732222" fontSize="48" cornerRadius="60" x="260" y="260" width="120" height="120"  click="onBioClick(event)" keyDown="onCancelKeyDown(event)" />
    <mx:Text right="160" y="150" fontSize="64" color="0xffffff"
                        text="bio"
                         />
    </mx:Canvas>
    <mx:Canvas id="programmingWindow" backgroundColor="#227373" width="400" height="400">
            <mx:Button label="info" color="0xf227373" fillColors="[0xffffff, 0xcccccc]"
fontSize="48" cornerRadius="60" x="25" y="25" width="120" height="120" click="onIprogrammingClick(event)" keyDown="onLoginKeyDown(event)" />
        <mx:Button label=" go " color="0xf227373" fontSize="48" cornerRadius="60" x="260" y="260" width="120" height="120"  click="onProgrammingClick(event)" keyDown="onCancelKeyDown(event)" />
   <mx:Text right="5" y="150" fontSize="64" color="0xffffff"
                        text="programming"
                         />
                         
    </mx:Canvas>
    <!-- ログインボックスを隠す -->
    <mx:Canvas id="baseCanvas" backgroundColor="#ffffff" x="0" y="0" width="100%" height="100%"/>
</mx:Application>