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
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");
}
