Forked from: mirkofresa's forked from: Flex+ReflectionView diff:128 forked from: forked from: Flex+ReflectionView mirkofresa forked:0favorite:1lines:181license : All rights reserved modified : 2010-01-12 00:29:42 Embed Tweet <?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" width = "250" height = "400" layout="absolute"> <mx:Script><![CDATA[ import flash.display.*; import flash.events.*; import flash.net.*; 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; public function OLHA() { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, onInit); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function():void { } ); loader.load(new URLRequest("http://sites.google.com/site/phresacorp/programming.jpg")); } private function onInit(event:Event):void { var loader:Loader = new Loader(); loader.loadBytes(event.currentTarget.bytes) } //コンテナ 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 onLoginClick(event:MouseEvent):void { Alert.show("jhfhjfjfjfBLA BLA BLxfgghloufynby7ufkudiy ouyfierA\n blabla fff","CONTACTS", Alert.OK | Alert.CANCEL, this); } private function onIcontactsClick(event:MouseEvent):void { Alert.show("CONTATTI BLA BLA BLxfgghloufynby7ufkudiy ouyfierA\n blabla fff","CONTACTS", Alert.OK | Alert.CANCEL, 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 { navigateToURL( new URLRequest('http://sites.google.com/site/phresacorp/contact')); } private function onMusicClick(event:MouseEvent):void { navigateToURL( new URLRequest('http://sites.google.com/site/phresacorp/music')); } private function onBioClick(event:MouseEvent):void { navigateToURL( new URLRequest('http://sites.google.com/site/phresacorp/bio')); } private function onProgrammingClick(event:MouseEvent):void { navigateToURL( new URLRequest('http://sites.google.com/site/phresacorp/programming')); } private function onVisualsClick(event:MouseEvent):void { 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 { } } ]]></mx:Script> <!-- ログインボックス --> <mx:Canvas id="visualsWindow" backgroundColor="#4b2273" 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="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="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:Button label=" go " fontSize="30" cornerRadius="37" x="300" y="300" width="75" height="75" 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="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="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="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="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> Code Fullscreen Preview Fullscreen Giggle : FlexPV3D Flex PV3D width label color id container CloseEvent.CANCEL navigateToURL rotationY target alpha CloseEvent.ENTER_FRAME CloseEvent height text interactive KeyboardEvent surfaceHeight URLRequest loadBytes bytes