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?

SilentDev
  • 20,997
  • 28
  • 111
  • 214

1 Answers1

1

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.

Vesper
  • 18,599
  • 6
  • 39
  • 61
  • Hm, okay so I first changed the AS2 file code to have event listeners on the buttons and then I created a new AS3 file and copied all the layers on the AS2 file to the AS3 file, saved it and then tried playing it and it says "WARNING: Actionsc on button or MovieClip insteances are not supported in ACtionSCript 3.0. All scripts on object instalces will be ignored." However, isn't it allowed for me to have actions and event listeners on buttons and movieclips in ActionScript 3.0? I did it before when I was creating an AS3 file, how come it isn't aloowing me to do it now? – SilentDev Sep 23 '13 at 13:46
  • Ah wait, i'm guessing I have to take all the code and put it all in just frame 1 instead of on the button itself, right? – SilentDev Sep 23 '13 at 13:50