SilentDev
SilentDev

Reputation: 22747

changing basic actionscript 2.0 code to actionscript 3.0

Okay so I have 10 frames, and on each frame, there is actionscript code which just says

stop();

there are also 9 buttons on the frames, ordered top to bottom. So when the top most button is rolled over, it should lead to frame 2 (since frame 1 is the default frame), and when you roll over the 2nd button, frame 3 should come, when you roll over the third button, frame 4 should come etc.. so the code on each button is basically just this

on (rollOver) {
    gotoAndStop(2);
}
on (rollOut) {
    gotoAndStop(2);
}

Above would be the actionscript 2.0 code for the first button. For the second button, the code would be the exact same except the '2' is switched with a '3'. My question is, when I go and click 'File' -> 'Publish Settings' (i'm using flash 5.5 on a Mac) and under the 'Script' section, it also allows me to pick ActionScript 1.0 or ActionScript 2.0 but the option to choose ActionScript 3.0 isn't there. How do I change it to ActionScript 3.0?

Would I have to change the code on each button to

button_name.addEventListener(event:MouseEvent.ROLL_OVER, rollOverFunc);
function rollOverFunc(event:MouseEvent):void {
    gotoAndStop(2)
}
button_name.addEventListener(event:MouseEvent.ROLL_OUT, rollOutFunc);
function rollOutFunc(event:MouseEvent):void {
    gotoAndStop(2)
}

Is that a / the only way to do it?

Upvotes: 0

Views: 1445

Answers (1)

Vesper
Vesper

Reputation: 18747

It's likely your project is made as AS2, so you can't advance to AS3 without rebuilding your entire FLA. You can do an export to SWC, then create a new FLA for Actionscript 3, and import that library.

About code, use addEventListener() and relative MouseEvent types.

Upvotes: 1

Related Questions