PDA

View Full Version : custom combobox executing listener twice


fou99004
07-21-2006, 05:43 PM
I created my own combobox component. I am now trying to add an eventlistener to the combobox that whenever something changes it calls my function. Right now there is only a trace call in my function but the wierd thing is that it is getting called twice. Has anybody had any issues with this. I really don't even know where to start looking so I am just trying to gather some ideas.

I do only have one listener created so I am pretty sure I haven't created two listener expecially since it is only doing it for anything using my custom component.

mooska
07-21-2006, 05:52 PM
post your code

fou99004
07-21-2006, 06:24 PM
k I will try my best. My comboBox is a drop up only comboBox. I reskinned it and built it from the standardComponents.fla that flash uses. I extended the combobox class with my own that has the displayDropdown function. In my modifyed function it does check the stage height it just automatically changes the necessary values:

// Dropdown will go below the bottom of the stage and be clipped.
// Instead, have it grow up. Position the mask above, too.
initVal = point.y - height;
endVal = initVal - dd.height;
mask._y = -dd.height;


In my class I am using delegates and this is the line that affects my dropup combobox:


cbxTnFont.addEventListener("change", Delegate.create(owner, updateTopNav));


I don't think you need it but just incase you want to see it, here is the updateTopNav function:

private function updateTopNav():Void{
Echo.trace("I am updating the Top Navigation.");
}


I hope this helps. I guess one possibility is that it is calling both of the displayDropdown functions(my extended combobox class and the original combobox class) and somehow registering to changes but I really don't think this is the case. I don't know that, that is why I am asking here. :)

mooska
07-21-2006, 06:32 PM
Youre extending ComboBoX class ? change event is your own (eventDispatcher) ?
If it is, I just think, that when youre dispatching your event, ComboBox class dispatches its own. but that just a thought.

Try to name your event differently. More I cant tell.