Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Beginner question about flickering

New Here ,
May 19, 2013 May 19, 2013

Ok, I'm new to ActionScript, but I can adapt quite easily, so I have started a project, it loads a XML file with some data, after it is loaded it adds a bar for every node it can find in the xml file. The bar is converted to a symbol and acts as a button. Now I want to add a label as a child to the bar. And there comes the problem, when I add the label to the bar, and compile the .fla the label is flickering all the time. I also pull some data from each node to add a text to the label, but its not beeing displayed either. Could someone please explain me, why the label is flickering and the bar is not?

Here is the code so far for adding the bars and the labels

var btn:Standing; // Symbol

                              var lbl:XmlLabel;

                              for (var i:int = 0; i < len; i++) {

                                        btn = new Standing();

                                        btn.x = 287;

                                        btn.y = 190 + i * 46;

                                        addChild(btn);

                                        btn.name = "btn" + i;

                                        btn.buttonMode = true;

                                        btn.addEventListener(MouseEvent.CLICK, onButtonClick);

 

                                        var teamElement:XML = teamElements;

                                        var nameString:String = teamElement.@name;

                                        var winString:String = teamElement.@wins;

                                        var lossesString:String = teamElement.@losses;

                                        var id:int = parseInt(nameString);

                                        for (var o:int = 0; o < 4; o++) {

                                                  lbl = new XmlLabel();

                                                  lbl.x = 20 + o * 70;

                                                  lbl.y = 10;

                                                  lbl.text = nameString.toString();

                                                  btn.addChild(lbl);

                                                  lbl.name = "lbl" + i + o;

                                        }

Thanks for the help

TOPICS
ActionScript
510
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 19, 2013 May 19, 2013

what is XmlLabel?  a textfield?  a movieclip?  something else?

Translate
Community Expert ,
May 19, 2013 May 19, 2013

what is XmlLabel?  a textfield?  a movieclip?  something else?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2013 May 19, 2013

XmlLabel is a MovieClip, I have dragged it from the components panel to my stage and deleted it and edited its properties in the library panel

EDIT: I have marked your answer as correct, because you hinted me to the correct solution, I had to make the Label's base class fl.controls.Label and not the standard

flash.display.MovieClip

Thanks for the hint

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2013 May 19, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines