7 Replies Latest reply on Jul 11, 2006 8:36 AM by Kris_Kros

    Creating a dynamic LinkButton


      I am creating a dynmaic linkbutton as follows:

      var myNewLinkBtn : LinkButton = new LinkButton;
      myNewLinkBtn.label = 'New Link Button';

      I am trying to add a click event to this. I thought myNewLinkBtn.click = 'somefunction()'; would work but it keeps giving me an "Access of possibly undefined property click through a reference with static type mx.controls:LinkButton." error.

      Does anyone have any ideas how I can assign a click event to a linkButton dynamically.

      thanks in advance