The smaller I made the browser window, the less CPU it took, it went from 80% to 40% to 20% etc...
Something to do with Flash? Don't think Away3dlite would be dependent on stage size...might be worth trying the same thing with just flash 10 3d planes, and seeing if you get the same result. -Pete On Fri, Jul 16, 2010 at 12:16 PM, Ali <[email protected]> wrote: > Hi Gurus, > > I am trying to create my site in away3Dlite but I am facing a big > problem that is when I run my website's first page it took about 80% > of CPU usage. > > CUP usage > http://www.riyasatali.com/site/cupusage.jpg > > Live link > http://www.riyasatali.com/site/site.html > > Here is my Code > > /***********************************************************/ > > package > { > import away3dlite.cameras.HoverCamera3D; > import away3dlite.containers.Scene3D; > import away3dlite.containers.View3D; > import away3dlite.materials.BitmapFileMaterial; > import away3dlite.materials.ColorMaterial; > import away3dlite.materials.MovieMaterial; > import away3dlite.primitives.Plane; > import away3dlite.primitives.Sphere; > > import flash.display.*; > import flash.display.BlendMode; > import flash.events.Event; > import flash.text.TextField; > > import flashx.textLayout.conversion.PlainTextExporter; > > [SWF(backgroundColor="#000000",frameRate=30)] > public class site extends Sprite > { > private var bgMaterial:BitmapFileMaterial; > private var View:View3D; > private var bgPlan:Plane; > private var tmpPlane:Plane; > private var scene:Scene3D; > private var splashes:Array; > private var mainCam:HoverCamera3D; > > private var tmpSprite:Sprite; > private var txtField:TextField; > > public function site() > { > // create a viewport > init(); > > addEvents(); > > addMaterials(); > resize(); > addObject(); > > > > } > private function init():void{ > scene=new Scene3D(); > mainCam=new HoverCamera3D(); > View = new View3D(scene,mainCam); > splashes=new Array(); > txtField=new TextField(); > tmpSprite=new Sprite() > var t_splashName:String=""; > > tmpSprite.addChild(txtField); > > for (var i:Number=1;i<=5;i++){ > t_splashName="assets/splash"+i+".png"; > > tmpPlane=new Plane(new > BitmapFileMaterial(t_splashName)); > //tmpPlane.layer.blendMode=BlendMode.ADD; > splashes.push(tmpPlane); > > //scene.addChild(splashes[i-1]); > //txtField.text+=" \n"+t_splashName; > splashes[i-1].rotationX=90; > splashes[i-1].mouseEnabled=false; > } > splashes.push(new Plane(new > BitmapFileMaterial("assets/ > splash6.png"))); > splashes[5].rotationX=90; > //splashes[5].layer=new Sprite(); > //splashes[5].layer.blendMode=BlendMode.ADD; > splashes.push(new Plane(new > BitmapFileMaterial("assets/ > enter1.png"))); > splashes[6].rotationX=90; > > > splashes[5].width=stage.fullScreenWidth; > splashes[5].height=stage.fullScreenHeight-100; > splashes[5].z=-50; > > splashes[5].material.smooth=true; > > //splashes[5].x=((stage.fullScreenWidth/2)-splashes[5].width/2); > //splashes[5].y=((stage.fullScreenHeight/2)- > (splashes[5].height*2)); > splashes[5].mouseEnabled=false; > splashes[6].mouseEnabled=false; > splashes[6].width=stage.fullScreenWidth; > splashes[6].height=stage.fullScreenHeight-100; > splashes[6].z=-80; > > splashes[6].material.smooth=true; > > scene.addChild(splashes[5]); > scene.addChild(splashes[6]); > /*var tPl:Plane=new Plane(new > MovieMaterial(tmpSprite)); > tPl.width=100; > tPl.height=100; > tPl.x=-200; > tPl.z=-200; > tPl.rotationX=90; > scene.addChild(tPl);*/ > > mainCam.distance=850; > mainCam.hover(); > //View.camera=mainCam; > addChild(View); > > } > private function addMaterials():void{ > bgMaterial=new BitmapFileMaterial("assets/bg.jpg"); > bgMaterial.smooth=true; > } > > private function addObject():void{ > > bgPlan = new Plane(bgMaterial); > > bgPlan.width=stage.fullScreenWidth; > bgPlan.height=stage.fullScreenHeight-120; > > bgPlan.rotationX=90; > bgPlan.mouseEnabled=false; > scene.addChild(bgPlan); > } > > private function addEvents():void{ > > addEventListener(Event.ENTER_FRAME,rndr); > addEventListener(Event.RESIZE,onResize); > } > > private function resize():void{ > stage.align=StageAlign.TOP_LEFT; > stage.scaleMode=StageScaleMode.NO_SCALE; > //View.camera.z=-600; > > View.x=stage.fullScreenWidth/2; > View.y=(stage.fullScreenHeight-100)/2; > > } > private function onResize(e:Event):void{ > resize(); > } > private function rndr(e:Event):void{ > var xDist:Number = mouseX - stage.fullScreenWidth * > 0.5; > var yDist:Number = mouseY - stage.fullScreenHeight * > 0.5; > > mainCam.tiltAngle=yDist/150; > mainCam.panAngle=xDist/150; > > mainCam.hover(); > > View.render(); > } > } > } > > /**********************************************************/ > > Please help thanks. > > Riyasat -- ___________________ Actionscript 3.0 Flash 3D Graphics Engine HTTP://AWAY3D.COM
