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 9052537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:11:54+00:00 2026-06-16T13:11:54+00:00

I have a really simple code piece like that; loadingMc.visible = true; trace(ok); //

  • 0

I have a really simple code piece like that;

loadingMc.visible = true;
trace("ok");
// send photo to server
loadingMc.visible = false;

Sending photo takes 3-5 seconds but movie clip becomes visible only for last second of process. I can see “ok” message in output at start of the process. So i assume problem is not redrawing movie clip. Is there any option to force redraw before process starts?

UPDATE:
Sending to server part;

upload.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{
    loadingText.visible = true;
    trace("ok");
    var bmd:BitmapData = new BitmapData(1024,768,true,0);
    bmd.draw(imageArea);
    savePicToServer(bmd);
});

function savePicToServer(bmd:BitmapData):void
{   
    var jpgEncoder:JPGEncoder = new JPGEncoder(85);
    var jpgStream:ByteArray = jpgEncoder.encode(bmd);

    var loader:URLLoader = new URLLoader();
    configureListeners(loader);
    var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
    var request:URLRequest = new URLRequest("http://localhost/test/upload.php?key=prvkey");
    request.requestHeaders.push(header);
    request.method = URLRequestMethod.POST;
    request.data = jpgStream;
    loader.load(request);
}

In the COMPLETE event;

loadingText.visible = false;
  • 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-16T13:11:55+00:00Added an answer on June 16, 2026 at 1:11 pm

    EDIT

    Just from reading your code, I don’t see why this should not be working – but FP does strange things sometimes.

    In similar cases, I used setTimeout() to force the player to delay the subsequent actions and allow the screen to refresh:

    upload.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{
        loadingText.visible = true;
        trace("ok");
        setTimeout( doSave, 10 );
    });
    
    private function doSave() : void {
        var bmd:BitmapData = new BitmapData(1024,768,true,0);
        bmd.draw(imageArea);
        savePicToServer(bmd);
    }
    

    If this still doesn’t work, perhaps a longer timeout will do the trick – but 10ms usually should be enough to refresh the screen.

    EDIT

    Another way would be to add and remove an ENTER_FRAME listener to make sure the frame really was refreshed:

    upload.addEventListener(MouseEvent.CLICK, function(evt:MouseEvent):void{
        loadingText.visible = true;
        trace("ok");
        addEventListener( Event.ENTER_FRAME, onNextFrame );
    });
    
    private function onNextFrame( ev:Event ) : void {
        removeEventListener( Event.ENTER_FRAME, onNextFrame );
        doSave();
    }
    
    private function doSave() : void {
        var bmd:BitmapData = new BitmapData(1024,768,true,0);
        bmd.draw(imageArea);
        savePicToServer(bmd);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple piece of code, that compiles in Delphi XE2 but not
I have to write a simple piece of code that acts on a file;
I have a really simple piece of code I'm just trying to follow the
I have a really simple XML file that I'm trying to read, but I
A really simple shell script question. I have a file with something like this:
I have a relatively small piece of initializer code that I want to run
I have really simple XML (HTML) parsing ANTLR grammar: wiki: ggg+; ggg: tag |
I have a really simple Rails app. Basically an article with comments. I want
I have a really simple blog application and I want to add a really
I have a really simple mod-rewrite rule : RewriteRule ^(.*)$ index.php?url=$1 [PT,L] As an

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.