Thanks Manish!

Robert L. Brueckmann
Senior Web Developer
Merlin Securities, LLC
595 Madison Avenue
New York, NY 10022
p: 212.822.4821
f: 212.822.4820

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Manish Jethani
Sent: Thursday, June 02, 2005 4:12 PM
To: [email protected]
Subject: Re: [flexcoders] FormItem icon attribute not working?

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



 
--------------------------------------------------------

This message contains information from Merlin Securities, LLC, or from one of 
its affiliates, that may be confidential and privileged. If you are not an 
intended recipient, please refrain from any disclosure, copying, distribution 
or use of this information and note that such actions are prohibited. If you 
have received this transmission in error, please notify the sender immediately 
by telephone or by replying to this transmission.
 
Merlin Securities, LLC is a registered broker-dealer. Services offered through 
Merlin Securities, LLC are not insured by the FDIC or any other Federal 
Government Agency, are not deposits of or guaranteed by Merlin Securities, LLC 
and may lose value. Nothing in this communication shall constitute a 
solicitation or recommendation to buy or sell a particular security.


 
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