I know this is a simple fix but I am new to learning AS 3.0 and was wondering if someone could help me.
I have 2 buttons on the stage whose each MouseEvent load a different external swf when clicked. In an attempt to get the current swf to fade out and new swf to fade in on button click, I vainly added a Tween to the function but to no avail.
As it is now, when the movie starts, the button 1 swf fades in, however, when button 2 is clicked, the new swf is loaded but the old swf does not fade.
Any help? Thanks guys.
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var image:Loader = new Loader();
addChild(image);
image.x = 0;
image.y = 95;
button1_mc.addEventListener(MouseEvent.CLICK, onButton1Click);
button2_mc.addEventListener(MouseEvent.CLICK, onButton2Click);
function onButton1Click(event:MouseEvent = null):void {
inContent("rectangle.swf");
}
function onButton2Click(event:MouseEvent):void {
inContent("square.swf");
}
function inContent(swfUrl:String):void {
var myTweenAlphaIn:Tween = new Tween(image, "alpha", Strong.easeOut, 0, 1, 10, true);
var url:URLRequest = new URLRequest ("swfs/" + swfUrl);
image.load(url);
}
onButton1Click();