forked from: flash on 2009-9-16

by hacker_9p8x8mco
♥0 | Line 46 | Modified 2009-09-22 04:53:58 | MIT License
play

ActionScript3 source code

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

<?xml version="1.0" encoding="utf-8"?>
<!-- forked from harukomugi's flash on 2009-9-16 -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
	xmlns:view="org.papervision3d.view.*" creationComplete="init();" 
	width="622" height="504" 
	backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #DEDEDE]" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
	import org.papervision3d.objects.primitives.Plane;

import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.objects.primitives.Sphere;

private var ball:Sphere;

//初期化関数
private function init():void{
	hts.send();

	//BasicViewをステージに追加
	myUI.addChild( bv );

	//オブジェクトの作成
	//ball = new Sphere( null , 500 , 10 , 10 );
	//bv.scene.addChild( ball );

	this.addEventListener(MouseEvent.MOUSE_MOVE , onMouseMove );

	//レンダリング。bv.startRendering();を自前で。
	this.addEventListener(Event.ENTER_FRAME , onTimer );

}

private function onMouseMove( e:Event ):void{
//	bv.camera.x = Math.sin( this.mouseX * Math.PI/180) * this.mouseX + 100;
//	bv.camera.y = Math.cos( this.mouseY * Math.PI/180) * this.mouseX + 100;
}
//レンダリング
private function onTimer( e:Event ):void{
	bv.renderer.renderScene( bv.scene , bv.camera , bv.viewport );
	//ball.rotationY += 1;
	bv.camera.x -= 10;
}
private function onResult( ):void{
	
	log.text = "" + hts.lastResult.item.length();

	for( var i:int = 0 ; i < hts.lastResult.item.length() ; i ++ ){
	
		var mat:BitmapFileMaterial = new BitmapFileMaterial( hts.lastResult.item[i].image.image1 );
		mat.doubleSided = true;
		var plane:Plane = new Plane( mat ,100 , 100 , 3 );
		plane.x = Math.random() * 600 - 600;
		plane.z = Math.random() * 600 - 600;
		plane.y = Math.random() * 600 - 600;
		plane.rotationX = Math.random() * 360;
		plane.rotationY = Math.random() * 360;
		plane.rotationZ = Math.random() * 360;
		bv.scene.addChild( plane );
	}
}
]]>
</mx:Script>
<mx:HTTPService id="hts" url="http://moeten.info/maidcafe/?type=shop&amp;tid=&amp;cid=1&amp;m=api&amp;image=on" result="onResult()" resultFormat="e4x"/>
<mx:UIComponent id="myUI" width="622" height="504" x="0" y="0"/>
<view:BasicView id="bv"/>
<mx:TextArea id="log" x="452" y="35"/>


</mx:Application>