Copy link to clipboard
Copied
Hey!! I need a help please, I want to resize an external swf flash to be displayed in full Height and full width of my stage, I used this code bellow and the problem that I faced is the flash file doesn't take any effect when I want to resize it, even if I placed numbers in swfLoader.width and swfLoader.height , still on its original size.
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
stop()
var swfLoader = new Loader();
var urlReq: URLRequest = new URLRequest("myfile.swf");
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onResize);
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete);
swfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, swfLoadError);
swfLoader.load(urlReq);
function onResize(event: Event): void {
trace(stage.stageHeight+" "+stage.stageWidth);
swfLoader.width = stage.stageWidth;
swfLoader.height = stage.stageHeight;
}
function swfLoadComplete(evt: Event): void {
var loader: Loader = Loader(evt.target.loader);
addChild(loader.content);
swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoadComplete);
}
function swfLoadError(evt: IOErrorEvent): void {
trace("Unable to load swf ");
swfLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, swfLoadError);
}
Copy link to clipboard
Copied
Try resizing the loader.content rather than the loader.
Copy link to clipboard
Copied
thanks for your reply, can you please tell me how can I put the loader.content inside onResize function?
I putted loader.content inside the swfLoadComplete function the flash file take all full screen but after a moments it return to its original size.
function swfLoadComplete(evt: Event): void {
var loader: Loader = Loader(evt.target.loader);
addChild(loader.content);
loader.content.width = stage.stageWidth;
loader.content.height = stage.stageHeight;
swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoadComplete);
}
Copy link to clipboard
Copied
I Try to resize the swfLoader.content inside the OnResize function using this code but it doesn't take effect, can you help please?
function onResize(event: Event): void {
swfLoader.content.width = stage.stageWidth;
swfLoader.content.height = stage.stageHeight;
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more