setStyle on a Label

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

setStyle on a Label

Scott Matheson-2
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

Reply | Threaded
Open this post in threaded view
|

Re: setStyle on a Label

kamcknig
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/
Reply | Threaded
Open this post in threaded view
|

Re: setStyle on a Label

Alex Harui-2
In reply to this post by Scott Matheson-2
Can you post a small test case?

On 9/20/18, 1:52 PM, "Scott Matheson" <[hidden email]> 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
   
   

Reply | Threaded
Open this post in threaded view
|

Re: setStyle on a Label

ScottM
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 <[hidden email]> wrote:
>
> Can you post a small test case?
>
> On 9/20/18, 1:52 PM, "Scott Matheson" <[hidden email]> 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
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: setStyle on a Label

Olaf Krueger
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/
Reply | Threaded
Open this post in threaded view
|

Re: setStyle on a Label

ScottM
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 <[hidden email]> 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/

Reply | Threaded
Open this post in threaded view
|

Re: setStyle on a Label

Olaf Krueger
> 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/