2 Replies Latest reply on Jan 16, 2010 6:55 AM by Gregory Lafrance

    Problem adding TextFields to custom preloader.

    Gregory Lafrance Level 6

      I'm creating a custom preloader by extending DownloadProgressBar.

       

      In the overridden initialize() method  I'm adding two TextFields, one above the label and progress bar and one below it.

       

      It works fine, except that the new TextFields display immediately, before the default DownloadProgressBar text displays.

       

      I need the new TextFields to display when the default DownloadProgressBar displays, not beforehand.

       

      Thanks in advance for any help you might provide.

       

      override public function initialize():void{
          super.initialize();
          // Attach the title TextField.
          _titleObj = new TextField();
          _titleObj.x = (stageWidth/2)-(borderRect.width/2)+labelRect.x;
          _titleObj.y = (stageHeight/2)-(borderRect.height/2)+15;
          _titleObj.width = 165;
          _titleObj.height = 32;   
          _titleObj.selectable = false;
          _titleObj.defaultTextFormat = super.labelFormat;
          _titleObj.htmlText = _title;
          _titleObj.multiline = true;
          _titleObj.wordWrap = true;
          _titleObj.textColor = 0xFFFFFF;  
          super.addChild(_titleObj);
          // Attach the marquee TextField.
          _marqueeObj = new TextField();
          _marqueeObj.x = (stageWidth/2)-(borderRect.width/2)+labelRect.x;
          _marqueeObj.y = (stageHeight/2)+(borderRect.height/2)-35;
          _marqueeObj.width = 165;
          _marqueeObj.height = 32;   
          _marqueeObj.selectable = false;
          _marqueeObj.defaultTextFormat = super.labelFormat;
          _marqueeObj.htmlText = _marquee;
          _marqueeObj.multiline = true;
          _marqueeObj.wordWrap = true;
          _marqueeObj.textColor = 0xFFFFFF;  
          super.addChild(_marqueeObj);
      }