Hand cursor?


mc.addEventListener(MouseEvent.CLICK,tween);

function tween(event:MouseEvent):void {
    trace("clicked");
}

it works but why is the hand cursor off?

I found buttonMode has to be set to true as well as useHandCursor…uhh shouldnt this be default for a button? I dont want to have to do that for everything with a CLICK event. How can I get around that?

Is it a button? You don’t say what mc is declared as but I’m assuming you declared it as a MovieClip (thus the name mc). Try declaring it as a Button class and see if that works.

I think you converted it into a movie clip and not a button.

Eew, don’t use buttons, just declare [FONT=“Courier New”]buttonMode [/FONT]to [FONT=“Courier New”]true[/FONT].

i have question along these lines:
How could I create and apply a custom external class that enables hand cursor for movieclips?
Seems like this should be possible.

Yes it is a movie clip. I never made buttons by selecting button. I always made movie clips. Setting button mode to true seems like an extra line of code I am going to have to do for it to act like a button. Seems like this should have been something default…

You really don’t need to create a custom external class, the ‘buttonMode’ property already exists, Snickelfritz.

Mrwicked, although it’s an extra line of code, by default you don’t want all objects to be buttons.

pretty much anything I have ever set to click(or onRelease) I would have wanted it to have a hand cursor…oh well though i’ll live with it

Right, but there are typically far more clips that aren’t clickable - your background image, your borders, your text, that sort of thing. All the content.

I understand that more clips aren’t clickable, but what would you be doing setting your background image or border to a click event in the first place?

I guess it really doesn’t matter. It all depends on what the project is you are working on.

Well, anyways, if you want to create a button in ActionScript use the SimpleButton Class. I don’t like the button when used on the stage, but as a display class I don’t see anything wrong with it. It just extends DisplayObject, which makes it pretty simple. So here’s the code to display a button on screen.

package {
	import flash.display.SimpleButton;
	import flash.display.Sprite;

	public class Test extends Sprite {
		public function Test() {
			var button:SimpleButton = new SimpleButton();
			var sprite:Sprite = new Sprite();
			sprite.graphics.beginFill(0);
			sprite.graphics.drawCircle(300,200,50);
			sprite.graphics.endFill();

			button.upState = sprite;
			button.downState = sprite;
			button.overState = sprite;
			button.hitTestState = sprite;
			
			addChild(button);
		}
	}
}