Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Resize loaded external swf flash

Guest
Oct 03, 2016 Oct 03, 2016

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

}

TOPICS
ActionScript
891
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2016 Oct 04, 2016

Try resizing the loader.content rather than the loader.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 04, 2016 Oct 04, 2016

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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 06, 2016 Oct 06, 2016
LATEST

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines