views:

215

answers:

1

I'm new to Flash Pro programming, and am trying to create a button-type symbol where I can set the label. The problems I'm running into are as follows.

  1. If I make the symbol type=Button, I can't add ActionScripts in the frames and/or access any subcomponents? Why is this so?
  2. If I make the symbol type=MovieClip, I can add ActionScript and access sub-components, but can't figure out how to make the HandCursor show up on hover?

Any ideas would be appreciated. Thanks..

A: 

There are a couple of ways to do it.

First off - you do have the ability to access sub components of a button and you can also add actionscript to it. However, I do the same as you and build any button using Movieclips as it gives you more freedom.

To overcome the hand pointer issue - there are two ways to reproduce this.

Firstly (my preference), it to simply build a button object. This would be invisible, or at worst by 1% opacity. and I'd place it on the upper most layer of the movieclip. It would not require any hover states or code - just so you can reproduce the hand icon.

The second option is to do it within the code. The one problem this tend to create - you would need to do the same code for the sub components, if not - then you might have selective text in this reproduced movieclip of which would change the mouse pointer to a text selection pointer (the I when you hover over text).

Its simple enough to produce. in the frame 1 of the movieclip add:

buttonMode = true;

and this will make the hand cursor also. You can read more about it here: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Sprite.html#buttonMode

Hope it helps

Glycerine
mouseChildren = false will take care of the sub components not being selectable or clickable.
Lars
So it does... Nice! +1
Glycerine
Thanks Glycerine- good ideas, and another way i found is to do mouseEnabled = false on subcomponents.
Yarin