Skip to main content
vlceversa
Known Participant
May 19, 2013
Answered

Beginner question about flickering

  • May 19, 2013
  • 1 reply
  • 565 views

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

This topic has been closed for replies.
Correct answer kglad

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

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 19, 2013

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

vlceversa
vlceversaAuthor
Known Participant
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

kglad
Community Expert
Community Expert
May 19, 2013

you're welcome.