# Problem with loading external swfs and Tweens

**URL:** <https://forum.kirupa.com/t/problem-with-loading-external-swfs-and-tweens/243408>\
**Category:** flash\
**Created:** [November 6, 2007, 6:43pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-swfs-and-tweens/243408 "2007-11-06T18:43:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![strutna](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@strutna](https://forum.kirupa.com/u/strutna)\
**Post date:** [November 6, 2007, 6:43pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-swfs-and-tweens/243408/1 "2007-11-06T18:43:59Z")

</div>

Hi,

I am currently in the process of transitioning from AS2 to AS3 and am having problems with a really simple script. Basically, as this is written, it loads a new specific external swf when each of the buttons are clicked. In AS2, I know I was able to load external swfs, give them an alpha of 0 and then use a Tween to increase their alpha to 100. When I do this in AS3, it still tweens them in, but I am unable to interact with the external swf. It just sits like it is when you first open it.

I am wondering if it is because I am using the loader as the Tween object. I tried putting the loader into a container and then tried to Tween the container, but that didn’t work either.

Any advice is appreciated! Thank you!

Here is my script:

import flash.display.Loader;  
import flash.display.Sprite;  
import flash.events._;  
import flash.net.URLRequest;  
import flash.display._;  
import fl.transitions._;  
import fl.transitions.easing._;

var swfs:Array = [“1.swf”, “2.swf”, “3.swf”, “4.swf”];

var loader:Loader = new Loader;  
var container:Sprite = new Sprite;  
var btnContainer:Sprite = new Sprite;

loader.load(new URLRequest(“1.swf”));

this.addChild(container);  
container.addChild(loader);

container.scaleX = .5;  
container.scaleY = .5;

for (var i:int=0; i\<swfs.length; i++) {  
var myBtn:MyBtn = new MyBtn();  
btnContainer.addChild(myBtn);  
myBtn.buttonMode = true;

```
myBtn.x = i*(myBtn.width+5);

myBtn.addEventListener(MouseEvent.MOUSE_UP, btnOnRelease);

```

}

this.addChild(btnContainer);  
btnContainer.y= 300;

function btnOnRelease(event:MouseEvent):void {  
for (var a=0; a\<btnContainer.numChildren; a++) {  
btnContainer.getChildAt(a).alpha = .5;  
}  
event.target.alpha = 1;  
var target:DisplayObject = btnContainer.getChildByName(event.target.name);  
loader.unload();  
loader.load(new URLRequest(swfs[btnContainer.getChildIndex(target)]));  
loader.alpha = 0;  
var loaderTween = new Tween(loader, “alpha”, Regular.easeIn, 0, 100, 3, true);  
}
