lundi 26 septembre 2016

Resize and load External SWF in full screen using AS3 in AIR

I'm noob at programing and I'm working with Flash Pro to develop an APP for android, and I have a problem to resize an external SWF to be displayed in full screen in left. First thing in my *.Fla project I have a button in "Scene 1" that can run a "Scene 2" using this code:

    play_btn.addEventListener(MouseEvent.CLICK, play_SWF);
    function play_SWF(event:MouseEvent):void
    gotoAndPlay(1,"Scene 2");   

The "Scene 2" should resize and display the external SWF in full screen and this is the code I'm trying:

    import flash.display.Loader;
    var swfLoader = new Loader();
    var urlReq: URLRequest = new URLRequest("myfile.swf");
    stage.displayState = StageDisplayState.FULL_SCREEN;
    stage.align = StageAlign.LEFT;
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete);
    swfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, swfLoadError);
    function swfLoadComplete(evt: Event): void {
    var loader: Loader = Loader(;
    add hold(loader.content);
    swfLoader.width = stage.stageWidth;
    swfLoader.height = stage.stageHeight;
    swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoadComplete);
    function swfLoadError(evt: IOErrorEvent): void {
    trace("Unable to load swf ");
  swfLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, swfLoadError);

The problem is that the external flash file displayed small in the top left of stage. Please can someone help :/

Aucun commentaire:

Enregistrer un commentaire