开发者

Button with dynamic text in Flash CS5

I'm new to Flash Pro pro开发者_StackOverflow社区gramming, 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..


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜