On 6/2/05, Robert Brueckmann <[EMAIL PROTECTED]> wrote:
> Anyone have any success getting this to work?  Like if I want a help
> bubble icon next to certain form fields, I can't do it because the icon
> doesn't show up...I have a work around but then the alignment of the
> form items gets thrown off...thoughts?

You can achieve the same by extending FormItem to reserve some space
for the icon and then placing the icon appropriately.

<?xml version="1.0"?>
<mx:FormItem xmlns:mx="http://www.macromedia.com/2003/mxml";>
  <mx:Script>
    import mx.controls.Image;

    // this holds the icon
    private var iconHolder:Image;

    public function createChildren():Void
    {
      super.createChildren();

      iconHolder = Image(createChild(Image, "", {source: icon}));
    }
    public function getViewMetrics():Object
    {
      var vm:Object = super.getViewMetrics();
      // reserve extra space for icon
      vm.left += iconHolder.width + getStyle("horizontalGap");
      return vm;
    }
    public function layoutChildren():Void
    {
      super.layoutChildren();

      var vm:Object = super.getViewMetrics();
      iconHolder.move(vm.left + getStyle("marginLeft"),
          vm.top + getStyle("marginLeft"));
    }
  </mx:Script>
</mx:FormItem>

Usage:

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
  xmlns="*">
  <mx:Form>
    <MyFormItem icon="@Embed('bubble.jpg')" label="Name">
      <mx:TextInput />
    </MyFormItem>
  </mx:Form>
</mx:Application>


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to