You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Scott Matheson <sc...@unitsofsound.com> on 2018/09/19 12:35:42 UTC

setStyle on a Label

Hi

     How do I make a text label appear in the center of an lable using AS3 code

 
     var _lsn:Label = new Label();
     _lsn.text = _”hellow”
     _lsn.setStyle("textAlign", "center");

 
 
the issue must be setStyle 

 
Scott


Re: setStyle on a Label

Posted by kamcknig <ka...@gmail.com>.
Your label needs a width. If you leave it at the default width, it resizes to
the length of the text. So you are centering it, you just can' tell. 

At least that is my guess, without knowing the layout of the Label component
within the parent.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: setStyle on a Label

Posted by Olaf Krueger <ma...@olafkrueger.net>.
> the first message that was sent out did not show up, so it was a duplicate
sorry 

I didn't want to complain, it just feels like a Déjà-vu.  
Thanks for explanation ;-)

Olaf



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: setStyle on a Label

Posted by scott matheson <sc...@matheson.it>.
the first message that was sent out did not show up, so it was a duplicate sorry 


> On 21 Sep 2018, at 11:59, Olaf Krueger <ma...@olafkrueger.net> wrote:
> 
> I just wonder why you've created this additional thread which seems to me to
> describe the same issue which already was resolved here [1]
> 
> Did I miss something?
> 
> Thanks,
> Olaf
> 
> [1] http://apache-flex-users.2333346.n4.nabble.com/Label-td17332.html
> 
> 
> 
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/


Re: setStyle on a Label

Posted by Olaf Krueger <ma...@olafkrueger.net>.
I just wonder why you've created this additional thread which seems to me to
describe the same issue which already was resolved here [1]

Did I miss something?

Thanks,
Olaf

[1] http://apache-flex-users.2333346.n4.nabble.com/Label-td17332.html



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: setStyle on a Label

Posted by scott matheson <sc...@matheson.it>.
the    _lsn.setStyle("textAlign", "center”);   only works if you have a width

so 

>        var _lsn:Label = new Label();
>         _lsn.text = _”hellow”
            _lns.width=100;
>         _lsn.setStyle("textAlign", "center");


works as it should, I had  assumed the width would have been inherited fro the parent 


> On 20 Sep 2018, at 23:33, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> Can you post a small test case?
> 
> On 9/20/18, 1:52 PM, "Scott Matheson" <sc...@unitsofsound.com> wrote:
> 
>    Hi
> 
>         How do I make a text label appear in the center of an lable using AS3 code
> 
> 
>         var _lsn:Label = new Label();
>         _lsn.text = _”hellow”
>         _lsn.setStyle("textAlign", "center");
> 
> 
> 
>    the issue must be setStyle 
> 
> 
>    Scott
> 
> 
> 


Re: setStyle on a Label

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Can you post a small test case?

On 9/20/18, 1:52 PM, "Scott Matheson" <sc...@unitsofsound.com> wrote:

    Hi
    
         How do I make a text label appear in the center of an lable using AS3 code
    
     
         var _lsn:Label = new Label();
         _lsn.text = _”hellow”
         _lsn.setStyle("textAlign", "center");
    
     
     
    the issue must be setStyle 
    
     
    Scott