在Adobe于5.15 发布Flash Player 10beta版以来一直想试试这个牛X的功能:3d支持
今天抽空玩了下3d旋转,性能上比之前pv3d,sandy,away3d等模拟出来的牛X很多
演示:(需要 ActiveX for IE / Plugin for Firefox ,否则看不到上面的效果)
package
{ import flash.display.Bitmap;import flash.display.Loader;import flash.display.Sprite;import flash.events.Event;import flash.net.URLRequest;import flash.display.StageAlign;public class main extends Sprite{ public function main(){ stage.align = StageAlign.TOP_LEFT;stage.scaleMode = "noScale";//load a picture as display objectvar ldr:Loader = new Loader();ldr.load(new URLRequest("photo1.jpg"));ldr.contentLoaderInfo.addEventListener("complete",onloaded);addChild(ldr);function onloaded(e:Event):void{ //trace(e.target.content)var bmp:Bitmap = Bitmap(e.target.loader.content);//bmp.width /= 2//bmp.height /= 2bmp.x = -bmp.width/2;bmp.y = -bmp.height/2;stage.addEventListener(Event.ENTER_FRAME, rotateMovieClip);}function rotateMovieClip(e:Event):void{ ldr.rotationX -= (stage.stageHeight/2-mouseY)/50;ldr.rotationY += (stage.stageWidth/2-mouseX)/50;//ldr.rotationZ += 5;ldr.x = stage.stageWidth/2;ldr.y = stage.stageHeight/2;}}}}posted on 2010-05-12 11:23 阅读(...) 评论(...)