[away3d] I am not getting full screen viewPort

31 views
Skip to first unread message

Ali

unread,
May 14, 2010, 7:41:52 PM5/14/10
to Away3D.dev, cyberh...@gmail.com
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

toshmosh

unread,
May 15, 2010, 7:36:01 AM5/15/10
to Away3D.dev
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:)

Ali

unread,
May 15, 2010, 8:46:41 AM5/15/10
to Away3D.dev
Thanks for your help toshmosh. But it does't work still I got this 4:3
screen

http://www.riyasatali.com/images/error.jpg

here is the jpg what i m getting in result.

Is there any thing I am missing ?

Rob Bateman

unread,
May 18, 2010, 7:26:34 PM5/18/10
to away3...@googlegroups.com
Hey Ali

have you tried setting your scale and align properties on the stage? If you want to have a 100% x 100% flash window in teh browser, your best setting is to tpe something like:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

does that solve the problem?

Rob
--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

Ali

unread,
May 18, 2010, 7:38:26 PM5/18/10
to Away3D.dev
Waow Thanks Rob. It worked perfectly now !!!! Thanks a lot guru. I owe
you a cup of tea :D
> rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com
Reply all
Reply to author
Forward
0 new messages