Este es el codigo del AS:
Código :
import gs.TweenLite;
stop();
Stage.align="LT"; // this is mandatory
Stage.scaleMode="noScale";
ancho_minimo = 1024;
alto_minimo = 600;
var loader:MovieClipLoader = new MovieClipLoader();
var loaderListener:Object = new Object();
// this function is dispatched durring the loadin progress
loaderListener.onLoadProgress = function(mc:MovieClip, loaded:Number, total:Number):Void
{
var percentage:Number = ( loaded / total) * 100;
load_button.loader_mc.loaderBar_mc._xscale = percentage;
trace('percent loaded ' + Math.round(percentage) +' % ');
}
// this function is dispatched when the loading process starts
loaderListener.onLoadStart = function(mc:MovieClip)
{
trace('load started');
}
// this function is dispatched when the loadin process is finished.
loaderListener.onLoadInit = function(mc:MovieClip)
{
trace('Finisihed loading image inside ' + mc);
// after we finish loading the image we hide the button , which also hides the loader , because the loader is in the button instance.
load_button._visible = false;
// also when the image is loaded, set the size of the image to fill in the whole screen
// pass the mc as the parameter for the funcition
setBgSize(mc);
}
// add the loaderListener to the MovieClipLoader instance .
loader.addListener(loaderListener);
load_button.onPress = function()
{
// when load_button is pressed , tell the loader to load the image in imageHolder mc.
[b]loader.loadClip('bg.swf',picHolder_mc);[/b]
}
//FUNCITON TO SCALE ANY MOVIE CLIP TO FIT THE WHOLE SCREEN
// scales the mc proportionally to fit full screen
function setBgSize(mc:MovieClip) { // pass in the mc to be scaled
//trace('setBgsize called ');
if (mc._width==0 || mc._height == 0) return;
var imageRatio:Number = mc._width/mc._height;
var stageRatio:Number = Stage.width/Stage.height;
if (stageRatio>=imageRatio) {
// match image width and adjust height to fit
mc._width = Stage.width;
mc._height = Stage.width/imageRatio;
} else {
// match image height and adjust width to fit
mc._height = Stage.height;
mc._width = Stage.height*imageRatio;
}
}
// listener that will listen to the onResize event that is fired when the stage is resized
var stageListener:Object = new Object();
stageListener.onResize = function()
{
// everytime the stage is resized , set the size of the image , which is held in the picHolder_mc
setBgSize(picHolder_mc);
}
// add the listener to the stage instance.
Stage.addListener(stageListener);Lo que me gustaria es que funcionara sin necesidad de oprimir el boton y cargando elementos de mi biblioteca. Alguien me podria decir, por favor?
Gracias!
