you dont call, setupBtnListeners() from anywhere.. how does the listener get added?
On 11/14/05, Bruno Mosconi <[EMAIL PROTECTED]> wrote: > > I've got a custom Button Class extending mx.core.UIComponent, it' working > fine till now... > > The point is, that I've got a simple DropDown menu, with buttons inside, > and > as I have a timeline to open it with animation Listeners don't WORK! I'm > getting crazy! > > Compiler gives no error. > > The file: > http://www.ultrafactor.com.br/flash_bug/SelMenu.zip > > The code: > > import com.ultrafactor.Button; > import mx.utils.Delegate; > class com.ultrafactor.SelMenu extends MovieClip > { > private var myInternal:Number; > private var bnt_0:Button; > > public function SelMenu() > { > main(); > } > > private function main():Void > { > myInternal = setInterval(this, "setTabButtonListeners", > 1000); > } > > private function setupBtnListeners():Void > { > var classPointer = this; > clearInterval(classPointer.myInternal); > > //DO NOT WORK! > bnt_0.addEventListener("click", Delegate.create(this, > clickBt)); > > } > > private function clickBt():Void > { > trace("clik");//DO NOT WORK > } > } > > My custom Button Class: > import mx.core.UIObject; > import mx.core.UIComponent; > class com.ultrafactor.Button extends mx.core.UIComponent > { > private var initializing:Boolean = true; > private var autoRepeat:Boolean; > private var interval; > > function Button() > { > super.init(); > useHandCursor = true; > } > > private function size(Void):Void > { > super.invalidate(); > } > > private function draw(Void):Void > { > if (initializing) > { > initializing = false; > } > size(); > } > > private function onRollOver():Void > { > if (interval != undefined) > { > clearInterval(interval); > delete interval; > } > > gotoAndStop(2); > } > > private function onDragOver():Void > { > onPress(); > } > > private function onRollOut():Void > { > gotoAndStop(1); > } > > private function onDragOut():Void > { > onRollOut(); > } > > private function onRelease():Void > { > dispatchEvent({type:"click"}); > > onRollOver(); > } > > private function onPress():Void > { > gotoAndStop(3); > > dispatchEvent({type:"buttonDown"}); > if (autoRepeat) > { > interval = setInterval(this, "onPressDelay", > getStyle("repeatDelay")); > } > } > > private function onPressDelay(Void):Void > { > dispatchEvent({type:"buttonDown"}); > if (autoRepeat) > { > clearInterval(interval); > interval = setInterval(this, "onPressRepeat", > getStyle("repeatInterval")); > } > } > > private function onPressRepeat(Void):Void > { > dispatchEvent({type:"buttonDown"}); > updateAfterEvent(); > } > } > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders