A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: TextField vs Text and Label

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    2

    TextField vs Text and Label

    Hopefully someone can explain the differences here to me.
    I am new to AS, and it's a little frustrating.

    I have a sprite and it's being added to a custom UI component

    Here is the drawing code within flex:

    Code:
    import flash.text.TextField;    
    import mx.controls.Label;
    import mx.controls.Text;
    var someText = new Text();
    var someTextField = new TextField();
    var someLabel = new Label();
    
    graphics.clear();
    graphics.lineStyle(1.0, lineColor, 1.0);
    graphics.beginFill(fillColor, 1.0);
    
    var radius:Number = size / 2;
    graphics.drawCircle(radius, radius, radius);
    
    someText.text = "Text";
    addChild(someText);
    
    someTextField.text = "TextField";
    addChild(someTextField);
    
    someLabel.text = "Finally a Label";
    addChild(someLabel);
    I have tried adding only one of the 3 children here (just textfield, just label, just text) and running independantly.

    The only text that actually DISPLAYS on the sprite is a textfield.
    The others don't seem to have been added at all, or at least don't display anything.

    The problem is that I don't want any interactivity.

    I just want to display text, so I would rather use a Label or a Text rather than a TextField, but for whatever reason this doesn't work for me.

    Can anyone let me know how I can get the Label to show up instead, or at least explain to me why there is an incompatibility?

    TextField: http://livedocs.adobe.com/flex/3/lan...TextField.html
    Text: http://livedocs.adobe.com/flex/3/lan...rols/Text.html
    Label: http://livedocs.adobe.com/flex/3/lan...ols/Label.html
    Last edited by sFoster83; 08-04-2008 at 09:25 PM.

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    567
    [/]
    Last edited by eggler; 10-14-2009 at 02:08 AM.

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Posts
    2
    Quote Originally Posted by eggler
    someTextField.selectable = false;

    That'll make it so you can't select the text in AS 3.0... what other interactivity were you worried about?

    I'm not sure about mixing in mx classes with Flex.
    I just wanted to use the smallest object possible, since I am going to be creating a ton of these sprites. Label seems to have less weight, so I preferred that over a textfield.

    i think there are some kind of incompatibility issues for the mx classes and flash classes like you're saying, which seems pretty short sighted on adobe's part. Oh well, I guess I need to get a book discussing in detail the differences between the as3 compiler and the mxml compiler

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center