Comunidad de diseño web y desarrollo en internet online

stage.width devuelve 0!!!!

Citar            
MensajeEscrito el 15 Oct 2008 02:39 pm
hola, resulta que tengo problemas con la propiedad stage en flash y as3. resulta que tengo una aplicación que al compilar usa porcentaje 100 x 100; y eso funciona barbaro, ahora quiero crear un rectangulo en la parte inferior que tenga 300 pixeles de alto y de ancho toda la pantalla, por lo tanto lo plantee asi:

Código :

var contenedor1:Sprite = new Sprite();
contenedor1.graphics.beginFill(0x0099FF)
contenedor1.graphics.drawRect(0, 0 , stage.width, 300);
contenedor1.graphics.endFill()
addChild(contenedor1);
trace(stage.width);


resulta que no sale nada, si cambio stage.width lo dibuja, y el trace(stage.width) devuelve 0.... COMO HAGO PARA SABER EL VALOR DEL TAMAÑO DE LA PANTALLA!!!!... gracias ya busque por todos lados y no esta esta simple solucion :cry:

Por demiantriebl

33 de clabLevel



 

chrome
Citar            
MensajeEscrito el 16 Oct 2008 10:27 am
Hola tenes que usar un Eventos para detectar los cambios de tamaño del stage.

Código :

function stageChange(e:Event):void{
   trace("width: "+stage.stageWidth);
   trace("height: "+stage.stageHeight);
}
stage.addEventListener(Event.RESIZE,stageChange);


saludos.

Por phoxer

Claber

827 de clabLevel

4 tutoriales

Genero:Masculino  

Ing en Sistemas

firefox
Citar            
MensajeEscrito el 06 Nov 2008 07:32 pm
La propiedad no es stage.width es stage.stageWidth!

Saludos,

Topicus

Por topicus

18 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.