Copy link to clipboard
Copied
I need help with this AS3 code...
shinyButton.onRollOver = function() {
this.glitter.play();
};
I keep getting this error-
Warning: 1090: Migration issue: The onRollOver event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( 'mouseOver', callback_handler).
Please help ASAP.
Thanks.
All I did was change the doc to AS2 and my first code worked fine.
Copy link to clipboard
Copied
your code is AS2
the correct code in AS3 is:
shinyButton.addEventListener(MouseEvent.MOUSE_OVER,overMouse);
function overMouse(e:MouseEvent):void{
this.glitter.play();
}
Copy link to clipboard
Copied
Now it says that the term "overMouse()" is undefined.
Copy link to clipboard
Copied
remove "()"
shinyButton.addEventListener(MouseEvent.MOUSE_OVER,overMouse);
function overMouse(e:MouseEvent):void{
this.glitter.play();
}
Copy link to clipboard
Copied
Thats exactly what i have
Copy link to clipboard
Copied
you have overMouse() and need overMouse
shinyButton.addEventListener(MouseEvent.MOUSE_OVER,overMouse()); ![]()
shinyButton.addEventListener(MouseEvent.MOUSE_OVER,overMouse); ![]()
Copy link to clipboard
Copied
This is what I have...
shinyButton.addEventListener(MouseEvent.MOUSE_OVER,overMouse);
function overMouse(e:MouseEvent):void{
this.glitter.play();
}
Copy link to clipboard
Copied
and it says that the...
overMouse
...is wrong
Copy link to clipboard
Copied
*is undefined
Copy link to clipboard
Copied
where is glitter in relationship to shinyButton? inside of it? or outside of it? if it is inside, change your scoping:
shinyButton.addEventListener(MouseEvent.MOUSE_OVER,overMouse);
function overMouse(e:MouseEvent):void{
e.target.glitter.play();
}
//---
and then brush up on your mouse events in as3 here:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent.html
Copy link to clipboard
Copied
All I did was change the doc to AS2 and my first code worked fine.
Copy link to clipboard
Copied
the code you show is as2
brush up on your mouse events in as3 here:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent.html
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more