2 Replies Latest reply on Nov 5, 2008 4:53 PM by Jim Daniel

    LinkButton click error

    Jim Daniel
      I get the error message "possibly undefined method displayFoxData" when I use the following code. BUT, when I use the exact same linkButton line not embedded inline bust just as a stand alone page element, as shown bellow in the AddChild code, works just fine. So what's going on here?
        • 1. Re: LinkButton click error
          chris.huston.t10 Level 3
          ItemRenderers are encapsulated, which means they do not have direct access to the parent application functions. You could have the itemRenderer issue an event when it is clicked and then listen for the event in the main application.Another, perhaps easier, approach is to use the outerDocument keyword to access the top level functions:

          <mx:itemRenderer>
          <mx:Component>
          <mx:LinkButton label="{data.Name}" color="#603913"
          textDecoration="underline" click="outerDocument.displayFoxData()">
          </mx:LinkButton>
          </mx:Component>
          </mx:itemRenderer>

          Other related keywords are: parentDocument, parentApplication, and Application.application

          Any of these will probably work in your case, though there are slight differences that you can read more about in the help docs if you have the need.

          Vygo
          • 2. Re: LinkButton click error
            Jim Daniel Level 1
            Thanks for the insite, parentApplication did the job once I changed the function displayFoxData to public from private.