You are currently browsing the monthly archive for April 2010.

One way to achieve this is to extend the Link Button class to display underline on mouse over event.

// code begins

package

{
 import flash.events.MouseEvent;
 
 import mx.controls.LinkButton;

 public class ULinkButton extends LinkButton
 {
  
  public function ULinkButton()
  {
   super();
   this.addEventListener(MouseEvent.MOUSE_OVER, showUnderline)
   this.addEventListener(MouseEvent.MOUSE_OUT, clearUnderline);
  }
  
  
  private function showUnderline(evt:MouseEvent):void
    {
     this.setStyle(“textDecoration”, “underline”);
    }
    
   private function clearUnderline(evt:MouseEvent):void
    {
     this.setStyle(“textDecoration”, “none”);
    }
 }
}

// code ends

The above class extends the the link button component and makes it to listen for mouse over and mouse out events and then sets the textDecoration property to either display underline or not.

Cheers!

Using modules in Flex 3 is a real pain in the back. While creating modules may be easy, but loading and unloading them is very difficult to manage. The best thing is to avoid using modules as much a possible.

There seems to be  better way to handle modules in Flex 4 as you can see from this post http://www.tink.ws/blog/flex-4-modules/.

Here is the code for creating multiline buttons in flex 3. After a lot of trial and error and googling the following seems to be working.

package
{
 import mx.controls.Button;
 import flash.display.DisplayObject;
 import flash.text.TextLineMetrics;
 import mx.core.UITextField;
 import flash.text.TextFieldAutoSize;

 import mx.core.IFlexDisplayObject;
 import mx.core.mx_internal;
 use namespace mx_internal;

 public class MultiLineButton extends Button
 {
  public function MultiLineButton()
  {
   super();
  }
  override protected function createChildren():void
  {
  super.createChildren();
  textField.multiline = true;
  textField.wordWrap = true;
  textField.autoSize = TextFieldAutoSize.LEFT;
  }

  override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
  {
  super.updateDisplayList(unscaledWidth, unscaledHeight);
  textField.y = (this.height-textField.height)>>1;
  }
  
 }
}

Try it in case you need it.

April 2010
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  

Blog Stats

  • 78,873 hits