PDA

View Full Version : [AS1 to AS3] Transitions Between External SWFs



smallDot
February 2nd, 2009, 08:24 AM
I am trying to convert the source in this tutorial from AS1 to AS3

http://www.kirupa.com/developer/mx2004/transitions.htm (http://www.kirupa.com/forum/../developer/mx2004/transitions.htm)

i think i am doing good :)
but i am missing something. i do not know what is it?
see the attachment please

the AS3 code is:


//Load Sec1
var requestDefSec1:URLRequest = new URLRequest("section1.swf");
var loadDefSec:Loader = new Loader();
loadDefSec.load(requestDefSec1);
addChild(loadDefSec);
//----------------------------
var container:URLRequest = new URLRequest(root.currMovie+".swf");
var loadContainer:Loader = new Loader();
loadContainer.load(container);
addChild(loadContainer);

//BUTTON1-----------------------------------------
sec1_btn.addEventListener(MouseEvent.CLICK, loadSec1);
function loadSec1(evt:MouseEvent):void {
if (root.currMovie == undefined) {
root.currMovie = "section1";
//Load the swf
var request:URLRequest = new URLRequest("section1.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
//----------------------
} else if (root.currMovie != "section1") {
if (container.currentFrame >= evt.target.midframe) {
root.currMovie = "section1";
container.play();
}
}
}

//BUTTON2-----------------------------------------
sec2_btn.addEventListener(MouseEvent.CLICK, loadSec2);
function loadSec2(evt:MouseEvent):void {
if (root.currMovie == undefined) {
root.currMovie = "section2";
//Load the swf
var request:URLRequest = new URLRequest("section2.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
//----------------------
} else if (root.currMovie != "section2") {
if (container.currentFrame >= evt.target.midframe) {
root.currMovie = "section2";
container.play();
}
}
}


any help
Thanks

smallDot
February 3rd, 2009, 12:38 AM
There is error:
1151: A conflict exists with definition container in namespace internal.

i did not understand what the error is pointing to

smallDot
February 6th, 2009, 07:14 PM
pros :)
please see this code and direct us what to do
please