Hi Sefi,

Here's a way that you can do that by extending Button:

// AS ---------------------------------------------------------------

package controls
{
import mx.controls.Button;



public class HTMLButton extends Button
{
      public function HTMLButton()
      {
           super();
      }

      override protected function
updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
      {
           super.updateDisplayList(unscaledWidth, unscaledHeight);

           textField.htmlText = label;
      }
}
}

// MXML
--------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
      xmlns:controls="controls.*"
      creationComplete="onCreationComplete()">



      <mx:Script>
           <![CDATA[
                private function onCreationComplete():void
                {
                     var myButtonHTMLText:String = "<u>O</u>pen";
                    myButton.label = myButtonHTMLText;
                }
           ]]>
      </mx:Script>



      <controls:HTMLButton id="myButton"/>



</mx:Application>

// ----------------------------------------------------------

-TH

--- In [email protected], "Sefi Ninio" <[EMAIL PROTECTED]> wrote:
>
> Hey,
>
> I have set up a keyboard shortcut to call the onButtonClick handler.
> Now, I'd like the button label to hint that the shortcut is present.
>
> For example, say the button label is 'Open' and the keyboard shortcut
is
> Ctrl-O, I'd like the button label to be *O*pen, with underline only
under
> the O.
>
> I've searched the API as well as google to no avail.
> I'm thinking of extending Button to enable this, but it probably won't
be
> trivial and I'd like to know if there's a simpler option before going
that
> path...
>
> Thanks,
> Sefi
>


Reply via email to