View Full Version : Component buttons onPress
Chewie
01-16-2006, 11:50 AM
Why is it that when you add an onPress event handler to a component button, when you click on it it no longer highlights as it did before the onPress event handler was added.
cancerinform
01-16-2006, 03:02 PM
Good point! Try onRelease or use a listener:
var a:Object = new Object ();
a.click = function () {
trace ("hello");
};
myBut.addEventListener ("click", a);
and it will be green again. Don't know the reason though.
Scottae
01-16-2006, 04:00 PM
Version 2 components in Flash MX 2004 and up use listeners to handle events. (http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002983.html) Throwing an onPress on the component screws that up. It makes the onPress event cover over anything internal to the component. Look here (http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00003117.html) on how to handle a Button component's events.
cancerinform
01-16-2006, 04:17 PM
As I said above. It works also with onRelease, so that cannot be the sole reason.
Scottae
01-16-2006, 04:39 PM
I don't know.......Seems to work for me reguardless onPress or onRelease. I am using Flash 8....so don't know if that has something to do with it. Either way, I would use the listener approach. It is what is recommended by MM.....I mean, Adobe.
Chewie
01-17-2006, 09:02 AM
I am using flash 8 as well. Cheers for the answers guys
Chewie
01-17-2006, 10:17 AM
Works great, thanks. I am a bit of a newbie, tring to teach myself on the job. I would really appreciate it if you could cast your professional eye over this.
http://www.actionscript.org/forums/showthread.php3?t=94176
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.