# Resizing Extnernal SWF (file Attached)

**URL:** https://forum.kirupa.com/t/resizing-extnernal-swf-file-attached/294058
**Category:** flash
**Created:** [August 7, 2009, 4:52pm UTC](https://forum.kirupa.com/t/resizing-extnernal-swf-file-attached/294058 "2009-08-07T16:52:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![eanimator](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@eanimator](https://forum.kirupa.com/u/eanimator)
#### Post date: [August 7, 2009, 4:52pm UTC](https://forum.kirupa.com/t/resizing-extnernal-swf-file-attached/294058/1 "2009-08-07T16:52:00Z")

</div>

Hello guys,

I am facing problem.

I am loading an external SWF and trying to resize according to the width and height (650 x 500).

I have code for the resize but its clipping from the right and bottom.

Any one?

```php

import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.StageAlign;
import flash.display.StageScaleMode;

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
            
var url:URLRequest = new URLRequest("external_swf.swf");
var loader:Loader = new Loader();
loader.load(url);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    

function completeHandler(event:Event):void{  
    mc.addChild(loader);
    mc.x=mc.y=0;
    _resize(event.target.width,event.target.height);
}

function _resize(lwidth,lheight):void {     
    var maxheight = 500;
    var maxwidth = 650;
    
    while ((lheight > maxheight) || (lwidth > maxwidth)){
        if (lheight-maxheight >= lwidth-maxwidth) {
           
            lwidth = (maxheight / lheight) * lwidth;
            lheight = maxheight;
        }
        else {
           
            lheight = (maxwidth / lwidth) * lheight;
            lwidth = maxwidth;
        }
    }

    mc.width = lwidth;
    mc.height = lheight;
    
}

```

External SWF file fla and swf is attached.

Awaiting your response.

Thanks in advance
