PDA

View Full Version : Help converting this as2 to as3



wuzzi2ya
September 24th, 2008, 11:35 AM
I have used this code (as2) before, but I am much more versed in as3. How would I convert this to as3? Code below:

b1.onRelease = function() {
if (_root.section != "profile.swf") {
_root.section = "profile.swf";
_root.transition.gotoAndPlay("closing");
}
};
b2.onRelease = function() {
if (_root.section != "gallery.swf") {
_root.section = "gallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b3.onRelease = function() {
if (_root.section != "printGallery.swf") {
_root.section = "printGallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b4.onRelease = function() {
if (_root.section != "photos.swf") {
_root.section = "photos.swf";
_root.transition.gotoAndPlay("closing");
}
};


Also if anyone has a better way of creating an intro and outro transition for manuvering through content, I would be open to it...

Thanks in advance...

Dom_
September 24th, 2008, 03:39 PM
A better way of doing it would be to make a TransitionManager class that handles that sort of behavior
but if you don't try that on your own you'll "neve"r get better.
practice makes perfect :)

sekasi
September 24th, 2008, 06:49 PM
You're using really bad code practice in AS2, just make sure you try to do it right from the start in AS3. Start with the fundamentals. Events and Listeners. Tons and tons of resources out there.