It works with forceMArgin, but... you don't need to create a theme 
to do so, probably only if you gonna use it in mxml, which I'm not.

I implemented it like this:

var b:Button = new Button();
b.createClassObject( CustomButtonSkin, "face_mc", 1, 
{styleName:StyleName});

Works perfectly!! Thanx.



--- In flexcoders@yahoogroups.com, Joe Berkovitz <[EMAIL PROTECTED]> wrote:
> Unfortunately it seems that it really *is* that hard.  Someone at 
> Macromedia should take note of the fact that the button label 
placement 
> appears to be hardcoded into the border metrics of ButtonSkin.
> 
> We wound up having to create a custom theme with its own 
ButtonSkin 
> subclass just to override this annoying behavior.  It uses a 
> "forceMargin" style to selectively override the hardcoded margin 
of 3 
> pixels.
> 
> To use this one must compile and make use of a theme containing 
the 
> following class -- somewhat involved, see MM docs 
for "programmatic 
> skinning".  Once done, one can override the margin by specifying a 
> "forceMargin: 1" or such, in the CSS style applied to one's button.
> 
> .       .    .  . ...j
> 
> ===================================================
> 
> import mx.skins.halo.ButtonSkin;
> import mx.core.ext.UIObjectExtensions;
> class yourPackageHere.CustomButtonSkin extends ButtonSkin
> {
>      static var symbolName:String = "ButtonSkin";
>      static var symbolOwner:Object = CustomButtonSkin;
> 
>      function getBorderMetrics():Object
>      {
>          var forceMargin = getStyle("forceMargin");
>          if (forceMargin == undefined)
>          {
>              return super.getBorderMetrics();
>          }
>          else
>          {
>              __borderMetrics = { left: forceMargin, top: 
forceMargin, 
> right: forceMargin, bottom:forceMargin };
>              return __borderMetrics;
>          }
>      }
> 
>      static function classConstruct():Boolean
>      {
>              UIObjectExtensions.Extensions();
>              _global.skinRegistry["CustomButtonSkin"] = true;
>              return true;
>      }
>      static var classConstructed:Boolean = classConstruct();
>      static var UIObjectExtensionsDependency:UIObjectExtensions = 
> UIObjectExtensions;
> }
> 
> 
> rockmoyosa wrote:
> > --- In flexcoders@yahoogroups.com, "rockmoyosa" 
<[EMAIL PROTECTED]> 
> > wrote:
> > 
> >>Ok ok , I got de icon in my Button,but...
> >>I resized the button to height = 17 and my label has a font-size 
of 
> > 
> > 10.
> > 
> >>but the effect is thathalf of my text is visble. So I want the 
> >>following:
> >>
> >>Or I can position my text with x and y
> >>or an marginTop = X(something).
> >>
> >>I find no standard solution in Flex?! Anybody!
> > 
> > 
> > Come it can't be that hard. Must I build my own Button just to 
place 
> > my label a little bit higher in the button?
> > 
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> > 
> > 
> >





 
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