1 Reply Latest reply on Jun 19, 2007 8:19 AM by Clark_Kent101

    Width of Dynamic Linkbutton

    Ukie_239
      I have a linkbutton created in actionscript, with text inputted into the box. I cannot get the width of the box. How can i get the width of a linkbutton created dynamically
        • 1. Re: Width of Dynamic Linkbutton
          Clark_Kent101 Level 1
          Hi Ukie,

          If i've understood what you're asking correctly - to get the width of a dynamically created link button you could do the following:

          <!--------------------------------------------------------------------------->

          private function init():void
          {
          var linkBtn:LinkButton = new LinkButton();

          linkBtn.x = 150;

          linkBtn.y = 168;

          linkBtn.name = "myLinkBtn";

          linkBtn.label = 'My Dynamic Link Button';

          myCanvas.addChild(linkBtn);

          linkBtn.addEventListener(FlexEvent.CREATION_COMPLETE, linkBtnHandler);
          }

          private function linkBtnHandler(evt:Event):void
          {
          trace(myCanvas.getChildByName('myLinkBtn').width);
          }


          <!--------------------------------------------------------------------------->

          Just make sure you have the function init() in the applications creationComplete event.

          Hope this helps,

          - Tony