Comunidad de diseño web y desarrollo en internet online

Resize de video (con su función incluida ;) )

Citar            
MensajeEscrito el 21 Feb 2008 10:39 pm
Ando haciendo unas modificaciones a un player de video.
El player 1ero carga una imagen de preview, y al presionar el botón de start entonces es cuando comienza a reproducir el video.
El problema que tengo es que cuando incrusto el player de video pero con menores dimensiones indicadas en el objeto flash, el video y la imagen no se logran centrar bien :S, en su tamaño normal no hay ningún problema.

Esta es la función con la que hago resize tanto al video como a la imagen del preview:

Código :

private function  resizeObjToRectangle(obj:DisplayObject,w:Number,h:Number,widthLimit:Number,heightLimit:Number):void {
         var whFactor:Number;
         var offset:Number;
         
         offset=11;
         trace("w = " + w + " h ="+ h);
         
            //  video proportion= 4/3 = .75
         // adjust first to the width
         if (w >= h && h <= heightLimit) {
            trace(">>>>>>>>>>>>     w>=h");
            whFactor=h/w;
            obj.width=Math.floor(widthLimit);
            obj.height=Math.floor(widthLimit*whFactor);
            if (obj.height>heightLimit) {
               whFactor=w/h;
               obj.height=heightLimit;
               obj.width=heightLimit*whFactor;
            }
         // adjust first to the height   
         } else if(w<h && h<=heightLimit) {
            trace("<<<<<<<<<<<<<      h<w");
            whFactor=w/h;
            obj.height=Math.floor(heightLimit);
            obj.width=Math.floor(widthLimit*whFactor);
            if (obj.width>widthLimit) {
               whFactor=h/w;
               obj.width=widthLimit;
               obj.width=widthLimit*whFactor;
            }
         }
         
         
         //center video 
         obj.x = (widthLimit/2)-(obj.width/2);
         
         if (h>heightLimit){
            obj.y=(heightLimit/2)-(h/2);
         }else{
            obj.y=(heightLimit/2)-(obj.height/2)-offset;            
         }
         
         trace("heightLimit = " + heightLimit);
         trace("weightLimit= " + widthLimit);
         
         trace("obj.x=" + obj.x);
         trace("obj.y=" + obj.y);
         
         trace("obj.width = " + obj.width);
         trace("obj.height = " + obj.height);
         


         trace("obj.name = " +obj.name);
         if (obj.name=="vid") {
            resizedFlag=true;
         }
         
            _borrarContador++;
         trace("RESIZED " +_borrarContador+ " times");
      }

Por Rafeo

650 de clabLevel

3 tutoriales
1 articulo

Genero:Masculino  

firefox
Citar            
MensajeEscrito el 22 Feb 2008 10:43 pm
¿Existe algún evento para detectar que el tamaño del swf ha cambiado?. Intenté con Event.ENTER_FRAME, Event.CHANGE ,Event.RESIZE,etc y no encuentro :S.

Por Rafeo

650 de clabLevel

3 tutoriales
1 articulo

Genero:Masculino  

firefox
Citar            
MensajeEscrito el 25 Feb 2008 04:59 pm
Ups, Event.RESIZE sí funciona bien:

Código :

stage.addEventListener(Event.RESIZE, stageResize);


El problema era que se tiene que indicar el scaleMode a NO_SCALE:

Código :

stage.scaleMode = StageScaleMode.NO_SCALE;


Seguimos trabajando en el resize, ahí les iré contando ;). Gracias.

Por Rafeo

650 de clabLevel

3 tutoriales
1 articulo

Genero:Masculino  

firefox
Citar            
MensajeEscrito el 28 Feb 2008 01:52 am
(se escuchan los grillos y el ruido de las teclas que estoy presionando)

Por Rafeo

650 de clabLevel

3 tutoriales
1 articulo

Genero:Masculino  

firefox
Citar            
MensajeEscrito el 28 Feb 2008 02:07 am

Por Dientuki

Claber

2021 de clabLevel

11 tutoriales
1 articulo

Genero:Masculino   Héroes

Front-end Ninja

firefox
Citar            
MensajeEscrito el 17 Jun 2008 03:33 pm
Hola tengo un pequeño problema con stage.width. Tengo este trocito de codigo:

Código :

stage.align = StageAlign.BOTTOM_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResize);

function stageResize (e:Event):void{
   trace(stage.width);
}   



Pero cuando redimensiona la pantalla no entiendo porque siempre me imprime 1440 que es el tamaño completo de la pelicula. Alguien me podria decir como lo tengo que hacer para que cada ves imprima el tamaño actual?

Gracias

Por Homer Jay

4 de clabLevel



Genero:Masculino  

firefox

 

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