Flex 4: Getting a reference to the host application or host mxml from ItemRenderers

Sometimes you have a custom ItemRenderer. That has, perhaps, a button that needs to access one of the methods of you’re main application. how would you accomplish this? read on…

To get a reference to the parent application simply use this:

this.parentApplication

Or if you want to navigate relitavly from the item renderer:

this.parentDocument

If your using a List component this will get a reference to that list

and this will get a reference to that List’s parent document:

this.parentDocument.parentDocument
NOTE: you can omit the ‘this’ keyword. Its a preference thing only.

You can also use these within any mxml document.

peace

-Bill

Tags: , , , , , , , , , ,

  • http://topsy.com/trackback?utm_source=pingback&utm_campaign=L2&url=http://www.wuup.co.uk/flex-4-getting-a-reference-to-the-host-application-or-host-mxml-from-itemrenderers Tweets that mention Flex 4: Getting a reference to the host application or host mxml from ItemRenderers | Wuup — Topsy.com

    [...] This post was mentioned on Twitter by Alan Hamlyn, Web Source Events and MarketMeTweet, PieDog Media. PieDog Media said: RT @Wuup Flex 4: Getting a reference to the host application or host mxml from ItemRenderers http://bit.ly/cE6aK2 [...]