import import flash.system.*; then type Capabilities.screenResolutionX and this will give you the screen res x for Y is Capabilities.screenResolutionY.
Hope it helps:) On 15 Май, 02:41, Ali <[email protected]> wrote: > Hi, > > I am trying to make one background that can fill the complete view > port but when it starts rendering it only display 4:3 ratio screen not > 16:9. I want to make bg adjust automatically according to the users > screen resolution. Here is a code I am trying to work with > > // > *************************************************************************** > ******// > package > { > import away3d.cameras.HoverCamera3D; > import away3d.containers.View3D; > import away3d.materials.TransformBitmapMaterial; > import away3d.primitives.Plane; > import away3d.primitives.Sphere; > > import flash.display.Bitmap; > import flash.display.Sprite; > import flash.events.Event; > > [SWF( backgroundColor="#0a0a0a")] > > public class bgtry extends Sprite > { > [Embed("../assets/bg.jpg")] > private var bg:Class; > > private var bgPlane:Plane; > private var cam:HoverCamera3D=new HoverCamera3D(); > private var sphr:Sphere; > private var view:View3D; > > private var bmpMat:Bitmap=new bg() as Bitmap; > private var stMat:TransformBitmapMaterial=new > TransformBitmapMaterial(bmpMat.bitmapData,{scaleX:1,scaleY:1}); > public function bgtry() > { > > init(); > } > private function init():void{ > view = new View3D(); > view.x=stage.stageWidth/2; > view.y=stage.stageHeight/2; > > bgPlane=new Plane({material:"orange#black"}); > bgPlane.width=stage.stageWidth*2; > bgPlane.height=stage.stageWidth*0.5; > > bgPlane.material=stMat; > bgPlane.segmentsH=5; > bgPlane.segmentsW=5; > > this.addChild(view); > > view.scene.addChild(bgPlane); > view.camera=cam; > // cam.zoom=10; > this.addEventListener(Event.ENTER_FRAME,entFrm); > view.render(); > } > private function entFrm(e:Event):void{ > //bgPlane.x-=0.5; > view.render(); > } > } > > } > > //***********************************************************// > > I am a beginner please help me how to solve this issue. Thanks in > advance
