Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8468885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:04:10+00:00 2026-06-10T16:04:10+00:00

I’ve been struggling with a Flash preloader. I just want it to update the

  • 0

I’ve been struggling with a Flash preloader. I just want it to update the text on the screen with the current percentage. Now it basically works as the trace outputs the correct percentages, but it won’t update the textfield I have on the screen. Once the trace gets to 100% however, the code does output “100” on the screen, but not until it’s all loaded. I don’t have the Flash IDE and am just using pure Actionscript with FlashDevelop. Here’s my code:

package 
{
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.display.Loader;
  import flash.events.ProgressEvent;
  import flash.net.URLRequest;
  import flash.net.URLLoader;
  import flash.display.Loader; 
  import flash.text.TextField;
  import flash.text.TextFormat;
  import flash.text.TextFieldType;


  public class Main extends Sprite 
  {
    public var myLoader:Loader = new Loader();
    public var image:String = "tmp/Avengers-poster.jpg";


    private var Title:TextField;
    private var txt:String;
    private var Form:TextField;

    public function Main():void {
      textbox("This is the title","box",100,100,200,30);

      myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
      myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady);

      var fileRequest:URLRequest = new URLRequest(image);
      myLoader.load(fileRequest);           
    }

    public function onProgressStatus(e:ProgressEvent):void {   
        // this is where progress will be monitored     
        var perc:int = Math.ceil((e.bytesLoaded/e.bytesTotal)*100);
        txt = perc.toString();
        Title.text = txt;
        addChild (Title);
        trace(perc); 
    }

    public function onLoaderReady(e:Event):void {     
        // the image is now loaded, so let's add it to the display tree!     
        addChild(myLoader);
    }   

    private function textbox (title_str:String,form_name:String,x:int,y:int,width:int,height:int):void {

       Title = new TextField ();
       Title.text = title_str;
       Title.selectable = false;
       Title.setTextFormat (new TextFormat ("Arial", 12, 0x777777, true));

       txt = ".";

       Title.x = x;
       Title.y = y;
       addChild (Title);
    }       

  }

}

Thanks for your help.

Darryl

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:04:12+00:00Added an answer on June 10, 2026 at 4:04 pm

    This will work. Don’t recreate the TextField on each status. You only need to addChild once and update the reference to it.

    package 
    {
        import flash.display.Loader;
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import flash.text.TextField;
        import flash.text.TextFieldType;
        import flash.text.TextFormat;   
    
        public class Main extends Sprite 
        {
            public var myLoader:Loader = new Loader();
            public var image:String = "http://apod.nasa.gov/apod/image/0605/titan5km_huygens_big.jpg";
    
            private var Title:TextField;
            private var Form:TextField;
    
            public function Main():void {
    
                createTextField("This is the title","box",100,100,200,30);
    
                myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
                myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady);
    
                var fileRequest:URLRequest = new URLRequest(image);
                myLoader.load(fileRequest);           
            }
    
            public function onProgressStatus(e:ProgressEvent):void {   
                // this is where progress will be monitored     
                var perc:int = Math.ceil((e.bytesLoaded/e.bytesTotal)*100);
                Title.text = perc.toString();
            }
    
            public function onLoaderReady(e:Event):void {     
                // the image is now loaded, so let's add it to the display tree!     
                addChild(myLoader);
            }   
    
            private function createTextField (title_str:String,form_name:String,x:int,y:int,width:int,height:int):void {
    
                Title = new TextField();
                Title.text = title_str;
                Title.selectable = false;
                Title.setTextFormat (new TextFormat ("Arial", 12, 0x777777, true));
    
                Title.text = ".";
    
                Title.x = x;
                Title.y = y;
    
                addChild (Title);
            }       
    
        }   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.