Quantumwave Interactive Inc.
  Interactive media development . Programming . Design . Consulting

Text MovieClip Button Event Handling

With the new event model in Flash MX, it is easy to assign events directly to movieclips. For example, a movieclip can now receive button events such as onPress or onRelease:

mc.onPress = function() {...};

However, when the movieclip only has a text field, the onPress event is only fired when the mouse is clicked on the solid part of the text. Clicking in the middle of the letter O, for example, will not fire the event.

These examples demonstrates one way to work around this problem, by using the hitArea property with a dynamically-sized movieclip. In the source file, there are two files:

TextButtonMC.fla - uses mcExtends() on a per instance basis

TextButtonMC2.fla - uses a component


Download source file: TextButtonMC.zip (Flash MX). For more Flash articles, click here.

Last updated on: May 14, 2002 - Copyright © 2002 Dave Yang / Quantumwave Interactive Inc.

home | about | news | flash | director | shockwave | download | dave | résumé | contact

Copyright © 1995-2009 Quantumwave Interactive Inc.