Re: [Flashcoders] hitTest vs onRollOver/onRollOut
The main thing that can really add up in processor is the number of MovieClips at the same level (sharing the same parent). You'll save processor best if you don't have any on-event events as well, such as onPress, etc. It's because Flash spends a lot on keeping up with it. It's really fun to play with ... I had a system that used _droptarget to get the topmost movieclip and dispatch events up it's parent chain much like AS3 does now. However, the processor was not too friendly, but I know I could do a lot more viable solution now-days. Let us know how it goes! Tyler On 5/22/06, phaedrus <[EMAIL PROTECTED]> wrote: Thanks a bunch for the info! I'm surprised to hear that the hitTest actually performs better, although I agree that the things I may have to add will more than balance it out. Basically, I'm trying to grow my own button class which has disabled and on/off states in addition to rollover and press. I'd like to be able to use hitTests rather than rollover and rolloff because I frequently run into situations where I want to put a button inside a movie which itself may have rollover or rolloff event handlers and the event doesn't reach my button. I like the hit test approach, but if there was a significant performance concern, I was going to have to consider another way of going about it. I've found some AS2.0 classes at http://www.senocular.com/flash/actionscript.php which may do part of what I need. The main trick now is to figure out how to make a nice packaged component that allows a designer to modify the look without having to do too much work. I hope to figure out how to deliver them similar to Elvis Mehmedovic's work (http://chq.emehmedovic.com/) where all the elements are readily available in the flash movie for tweaking if necessary. - phaedrus -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tyler Wright Sent: Friday, May 19, 2006 11:02 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] hitTest vs onRollOver/onRollOut phaedrus, You will find that, in the beginning, the hitTests will use up less processor (better performance). The examples you have below, for example. However, if you program all the logic you'd need to behave exactly as the other method (keeping track of all the details, etc) you'll quickly begin to match the performance and it may end up not being worth the time and bugs anymore. I still want to build a hitTest solution, mostly for my own enjoyment, that will at least have equal performance if not better. But it becomes harder for other developers to work with non-standard inventions, cool as they may be, and eventually people just get frustrated with your code. If it's just for you or you don't plan and building a full mouse-behavior replacement, try experimenting with _dropTarget ... there's some possibilities there ;) good luck, Tyler On 5/17/06, phaedrus <[EMAIL PROTECTED]> wrote: > > Does anyone know if there is a performance difference between hitTest and > onRollOver/onRollOut? > > For instance, if I had 100 movie clips on a lower-spec computer, would > there > be a notable processing difference between these two approaches: > > myMC.onMouseMove = function() { > if(this.hitTest(_root._xmouse,_root._ymouse,true)) { > trace("Roll Over"); > } else { > trace("Roll Out"); > } > } > > Or > > myMC.onRollOver = function() { > trace("Roll Over"); > } > myMC.onRollOut = function() { > trace("Roll Out"); > } > > I've also got some concerns regarding using _root._xmouse (etc) based on > the > comments at: > > http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht > m?href=Part4_ASLR2.html > but I've not yet looked to deeply into working around it (presumably by > not > using _root). However, if anyone knows that the situation is > unresolvable, > that'd be good to know. > > - phaedrus ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] hitTest vs onRollOver/onRollOut
Thanks a bunch for the info! I'm surprised to hear that the hitTest actually performs better, although I agree that the things I may have to add will more than balance it out. Basically, I'm trying to grow my own button class which has disabled and on/off states in addition to rollover and press. I'd like to be able to use hitTests rather than rollover and rolloff because I frequently run into situations where I want to put a button inside a movie which itself may have rollover or rolloff event handlers and the event doesn't reach my button. I like the hit test approach, but if there was a significant performance concern, I was going to have to consider another way of going about it. I've found some AS2.0 classes at http://www.senocular.com/flash/actionscript.php which may do part of what I need. The main trick now is to figure out how to make a nice packaged component that allows a designer to modify the look without having to do too much work. I hope to figure out how to deliver them similar to Elvis Mehmedovic's work (http://chq.emehmedovic.com/) where all the elements are readily available in the flash movie for tweaking if necessary. - phaedrus -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tyler Wright Sent: Friday, May 19, 2006 11:02 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] hitTest vs onRollOver/onRollOut phaedrus, You will find that, in the beginning, the hitTests will use up less processor (better performance). The examples you have below, for example. However, if you program all the logic you'd need to behave exactly as the other method (keeping track of all the details, etc) you'll quickly begin to match the performance and it may end up not being worth the time and bugs anymore. I still want to build a hitTest solution, mostly for my own enjoyment, that will at least have equal performance if not better. But it becomes harder for other developers to work with non-standard inventions, cool as they may be, and eventually people just get frustrated with your code. If it's just for you or you don't plan and building a full mouse-behavior replacement, try experimenting with _dropTarget ... there's some possibilities there ;) good luck, Tyler On 5/17/06, phaedrus <[EMAIL PROTECTED]> wrote: > > Does anyone know if there is a performance difference between hitTest and > onRollOver/onRollOut? > > For instance, if I had 100 movie clips on a lower-spec computer, would > there > be a notable processing difference between these two approaches: > > myMC.onMouseMove = function() { > if(this.hitTest(_root._xmouse,_root._ymouse,true)) { > trace("Roll Over"); > } else { > trace("Roll Out"); > } > } > > Or > > myMC.onRollOver = function() { > trace("Roll Over"); > } > myMC.onRollOut = function() { > trace("Roll Out"); > } > > I've also got some concerns regarding using _root._xmouse (etc) based on > the > comments at: > > http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht > m?href=Part4_ASLR2.html > but I've not yet looked to deeply into working around it (presumably by > not > using _root). However, if anyone knows that the situation is > unresolvable, > that'd be good to know. > > - phaedrus ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] hitTest vs onRollOver/onRollOut
phaedrus, You will find that, in the beginning, the hitTests will use up less processor (better performance). The examples you have below, for example. However, if you program all the logic you'd need to behave exactly as the other method (keeping track of all the details, etc) you'll quickly begin to match the performance and it may end up not being worth the time and bugs anymore. I still want to build a hitTest solution, mostly for my own enjoyment, that will at least have equal performance if not better. But it becomes harder for other developers to work with non-standard inventions, cool as they may be, and eventually people just get frustrated with your code. If it's just for you or you don't plan and building a full mouse-behavior replacement, try experimenting with _dropTarget ... there's some possibilities there ;) good luck, Tyler On 5/17/06, phaedrus <[EMAIL PROTECTED]> wrote: Does anyone know if there is a performance difference between hitTest and onRollOver/onRollOut? For instance, if I had 100 movie clips on a lower-spec computer, would there be a notable processing difference between these two approaches: myMC.onMouseMove = function() { if(this.hitTest(_root._xmouse,_root._ymouse,true)) { trace("Roll Over"); } else { trace("Roll Out"); } } Or myMC.onRollOver = function() { trace("Roll Over"); } myMC.onRollOut = function() { trace("Roll Out"); } I've also got some concerns regarding using _root._xmouse (etc) based on the comments at: http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht m?href=Part4_ASLR2.html but I've not yet looked to deeply into working around it (presumably by not using _root). However, if anyone knows that the situation is unresolvable, that'd be good to know. - phaedrus ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] hitTest vs onRollOver/onRollOut
Does anyone know if there is a performance difference between hitTest and onRollOver/onRollOut? For instance, if I had 100 movie clips on a lower-spec computer, would there be a notable processing difference between these two approaches: myMC.onMouseMove = function() { if(this.hitTest(_root._xmouse,_root._ymouse,true)) { trace("Roll Over"); } else { trace("Roll Out"); } } Or myMC.onRollOver = function() { trace("Roll Over"); } myMC.onRollOut = function() { trace("Roll Out"); } I've also got some concerns regarding using _root._xmouse (etc) based on the comments at: http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht m?href=Part4_ASLR2.html but I've not yet looked to deeply into working around it (presumably by not using _root). However, if anyone knows that the situation is unresolvable, that'd be good to know. - phaedrus ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com