FORUMS: list search recent posts

AS3 - why does this not work with Multiple scenes?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
AS3 - why does this not work with Multiple scenes?
on Jan 15, 2008 at 2:13:13 am

I created the below action script which executes basic button rollover effects using an array loop. It works fine when I have only one scene in my file.

// set up rollover actions //
function buttonRollover(evt:Event):void {"over");
function buttonRollout(evt:Event):void {"out");

// set up button array //
var aButtons:Array= new Array (mcHomeBtn,mcMusicBtn,mcServicesBtn,mcPhotoBtn);

// set up event listeners for rollover actions //
for (var i:Number=0; i aButtons[i].addEventListener(MouseEvent.ROLL_OVER,buttonRollover);
aButtons[i].mouseChildren = false;

As soon as I duplicate the scene it gives me this error and none of the rollover effects work on either scene.

1021: Duplicate function definition.
1021: Duplicate function definition.
1151: A conflict exists with definition aButtons in namespace internal.
1151: A conflict exists with definition i in namespace internal.

I assume it has something to do with the fact that I duplicated the AS when I created the second scene. However if I go into scene 2 and delete the AS from there, only scene 1 will give me the rollover effects.

Is there something I need to modify in my AS to get it to not error out?

Return to posts index

Lawrence Finn
Re: AS3 - why does this not work with Multiple scenes?
on Oct 30, 2008 at 1:56:24 am

Try a unique variable for each scene; even though they all call the same function, this ought to get around the unique identifier issue on the function.

Any ideas why stop(); works on a scene but once any further AS is added it causes the stop to fail and the movie to cycle.

I'm pretty new to this so apologies if the answer I gave isn't quite the there.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved