Skip to main content
May 15, 2007
Question

How to change the mouse on an accordion header onRollOver

  • May 15, 2007
  • 6 replies
  • 481 views
Hello, i'd like to know how can i change the mouse skin on a accordion header onRollOver.
I juste whant it to looks like the pointer of an onRelease button (the little hand with a finger) when my mouse is on the headers of my accordeon component.

Thanks for the help
This topic has been closed for replies.

6 replies

May 15, 2007
Great it works!!!! Thank you

this.onEnterFrame = function() {
for (var b = 0; b<myAccordian.numChildren;b++) {
myAccordian.getHeaderAt(b).useHandCursor = true;
}
delete this.onEnterFrame;
}
Inspiring
May 15, 2007
kglad, Raymond : good points. I actually checked the CPU load in task manager, but it was only 2 children in the accordian so not very thorough...and I knew it wasn't a good way to do it (I don't know if 'hackery' is the right term, but its what I meant).

the mouseMove would make a lot more sense than my approach.

I tried the doLater (which I'm not so familiar with, I think its executed after the components internal redraw, right? - so it makes sense to me as an approach) but couldn't get it to work.

kglad
Community Expert
Community Expert
May 15, 2007
it's the best way i know and is less cpu intensive than the code given by gwd.

you can improve on gwd's coding by using an onMouseMove handler instead of an onEnterFrame handler. if your accordian doesn't have many children that code shouldn't cause any problem.

Inspiring
May 15, 2007
You can use the component's doLater method:

myAccordion.doLater(this, "doIt");

function doIt(){
for(var i:Number = 0; i< myAccordion.numChildren; i++){
myAccordion.getHeaderAt(i).useHandCursor=true;
}
}


May 15, 2007
Tank's but, is the only way?
Inspiring
May 15, 2007
I don't think the components let you alter this default behaviour in any easy way (at least none that I can think of). You can set the useHandCursor property at the accordian header level, but the component (being very helpful) resets it to false.

You can do it with a bit of hackery, just continually setting it at the frame rate:

If your accordian is called myAccordian then put this in a frame on the timeline where it exists (or add it to an existing onEnterFrame handler if you already have one) :

this.onEnterFrame = function() {
for (var b = 0; b<myAccordian.numChildren;b++) {
myAccordian.getHeaderAt(b).useHandCursor = true;
}
}
kglad
Community Expert
Community Expert
May 15, 2007
use the Mouse.hide() and Mouse.show() methods and a movieclip of your hand with a finger.