I want to create a custom button in ActionScript.
This is my code:
import flash.events.MouseEvent;
import mx.controls.Alert;
import spark.components.Button;
public class BookViewButton extends Button
{
public function BookViewButton()
{
super();
}
override protected function mouseOver(event:MouseEvent,increase:int,newImageSource:String):void{
Alert.show("mouseOver for new class works");
}
}
But Adobe Flash Builder signals the method overriding line as an error.
I tried to change the new method signature so that it would match exactly, like this: (I thought the error might be because I was adding extra parameters to the mouseOver function so Flex might have not recognized it as an overriding)
override protected function mouseOver(event:MouseEvent):void{
Alert.show("mouseOver for new class works");
}
But still it doesn’t work. Same little red exclamation mark comes up to signal a mistake.
I’d greatly appreciate any help. Thanks.
What SDK version do you use if you have
mouseOver()method in SparkButtonhierarchy?Spark button has
mouseEventHandler()method to override:And it is better to post the error text which IDE gives you. To copy it just open
Problemsview in Flash Builder, found your error message and copy it via context menu.