Interesting approach.. Thanks Jer On 1/31/08, Jer Brand <[EMAIL PROTECTED]> wrote: > > There are probably a hundred other ways to do this, but an easy one > (off the top of my head) would be to make your holder variable a > custom element that extends sprite, but has it's own variables, like: > > > class HolderClass extends Sprite > { > private var _myParam:String > public function HolderClass() > { > super() ; > } > public function get myParam():String { return _myParam ; } > public function set myParam(value:String):void { _myParam = value; } > } > > Then the code you list would be..... > > var holder:HolderClass = new HolderClass() ; > holder.name = "theName"; > holder.myParam= "theParam" ; > holder.addEventListener(MouseEvent.MOUSE_UP, myEvent); > > > private function myEvent(e:MouseEvent) { > dispatchEvent(new DropDownEvent (SELECTED, e.target.name, > HolderClass(e.target).myParam)); > } > > As I said above, there are probably a ton of ways to do this better, > but this might have the least impact on your existing code. > > Jer > > > On Jan 31, 2008 4:01 PM, Helmut Granda <[EMAIL PROTECTED]> wrote: > > I am having a little bit of issue wrapping my head about this easy > task. I > > think my brain is fried. > > > > I have created a dropdown component... now when the user selects an > element > > from the dropdown i can listen for the MOUSE_UP and call a method, that > > method dispatches a custom event. > > > > Now I am assigning the name of each one of the elements of the drop down > so > > that I can pass that along to the method that dispatches the custom > event, > > but I also want to add an extra parameter but I dont seem to be able to > > figure out how since I am creating all the elements at the same time > that > > adding the MOUSE_UP listeners... > > > > > > something like > > > > var holder:Sprite = new Sprite; > > holder.name = "theName"; > > ...morecode > > > > holder.addEventListener(MouseEvent.MOUSE_UP, myEvent); > > > > > > private function myEvent(e:MouseEvent) { > > trace(e.target.name); > > // How about being able to pass an extra parameter? > > //From here I am able to dispatch a custom event like so: > > dispatchEvent(new DropDownEvent (SELECTED, e.target.name)); > > //but I need to pass an extra item like so > > dispatchEvent(new DropDownEvent (SELECTED, e.target.name, secondParam)); > > } > > > > TIA > > _______________________________________________ > > 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 >
-- ...helmut _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders