This content has been marked as final. Show 3 replies
"Cr99" <email@example.com> wrote in message
> One thing I have run into several times now in Flex is that with mx tags,
> can pass your own args to eventlisteners, but not in Actionscript. For
> <mx:LinkButton click="myFunction("customArgs")/>
> works great but
> var link:LinkButton = new LinkButton();
> link.addEventListener(MouseEvent.CLICK, myFunction("customArgs"));
> doesn't work in ActionScript. I have an ArrayCollection with two fields:
> name (for the link name), and id(which helps me generate the url). How
> can I
> get the eventlistener to access the id of the object when everything is
> in Actionscript?
Is there any association between your button and the data? For instance, if
this is in an itemRenderer, you can probably use event.currentTarget.data.
Normally, there will be some kind of direct relationship that you can use so
that the event is able to pass you the data you need.
If not, you can probably create your own event and dispatch it.
Have you tried ...
Yes that works! Brilliant! I forgot that components already have an 'id' field and that I could smuggle in my id that way.