PDA

View Full Version : AS2 and AS3 - Lost in translation



speeepyhead
May 5th, 2009, 12:58 PM
I need to translate this AS2 code into AS3 ASAP!

Please, help me if you know how to translate a few lines from AS2 to AS3
Here's the code:

http://onestoptutorial.com/tutorials/flash/button_that_stay_down_after_clicked.php


Here's the explanation:
Hi, everyone, I was supposed to make a flash 9.0 cs3 menu with buttons that stay down until another button is clicked.
I've found an example of this on the net, one that is perfect in every way for what I need to have done.
However, as always, there's a catch. The code on that site is written in AS2, which doesn't work for me because I'm using some functions which are incompatible with it (I suppose they're AS3 supported only, e.g. loaderComplete)

This is urgent, people, I'm going crazy. Could you, please, translate that code into AS3 (don't worry it's only a few lines) or send me a link to a similar example written in AS3 because this assignmnet was due like, yesterday.

akiersky
May 5th, 2009, 01:39 PM
looks like your link is broken, maybe just post the code here if it is short.

speeepyhead
May 5th, 2009, 04:43 PM
looks like your link is broken, maybe just post the code here if it is short.


actually, link is ok, but here is the code:


ActionScript Code:

this.button1.textBTN_txt.text = "ABOUT US";
this.button2.textBTN_txt.text = "SERVICE";
this.button3.textBTN_txt.text = "PORTFOLIO";
this.button4.textBTN_txt.text = "CONTACT";
var buttonNum:Number = 4;
for (i=1; i<=buttonNum; i++) {
this["button"+i].onRollOver = function() {
if (this.clicked != "yes") {
this.gotoAndPlay("over");
}
};
this["button"+i].onRollOut = function() {
if (this.clicked != "yes") {
this.gotoAndPlay("out");
}
};
this["button"+i].onRelease = function() {
this.gotoAndStop("out");
this._parent[_root.clickedButton].gotoAndPlay("out");
this._parent[_root.clickedButton].clicked = false;
this._parent[_root.clickedButton].enabled = true;
_root.clickedButton = this._name;
this.clicked = "yes";
this.enabled = false;
_root.on_txt.text=this._name +" in "+this.textBTN_txt.text;