Click here to Skip to main content
13,095,658 members (52,509 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to load external pictures (that will end up changing periodically) without interfering with the end-user's work in Adobe Flash. What I want would be similar to Multi-Threading technology in the Programming Languages.
I am using the following code for load external pictures:
private var ldrExternalPreloader:Loader;
private var pictureHolderMovieClip:MovieClip;
private var showPreloader:Boolean;
private var preloaderMovieClip:MovieClip;
private var progressIndicator:TextField;
public final function Preloader(strFilePathName:String, mcPictureHolder:MovieClip, bolPreloader:Boolean = true, mcPreloader:MovieClip = null, txtDynProgressIndicator:TextField = null):void 
    ldrExternalPreloader = new Loader();
    ldrExternalPreloader.load(new URLRequest(strFilePathName));
    filePathName = strFilePathName;
    fictureHolderMovieClip = mcPictureHolder;
    showPreloader = bolPreloader;
    preloaderMovieClip = mcPreloader;
    progressIndicator = txtDynProgressIndicator;
    if (bolPreloader)
        if (mcPreloader != null)
            mcPreloader.visible = true;
        trace("*************************" + " External Preloader Informtion " + "*************************");
        ldrExternalPreloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, ldrExternalPreloader_Progress);
    ldrExternalPreloader.contentLoaderInfo.addEventListener(Event.COMPLETE, ldrExternalPreloader_Complete);
private function ldrExternalPreloader_Progress(progEvent:ProgressEvent):void 
    var numProgressCompletePercent:Number = Math.floor((progEvent.bytesLoaded * 100) / progEvent.bytesTotal);
    if (progressIndicator != null)
        progressIndicator.text = numProgressCompletePercent + "%";
    if(preloaderMovieClip is MovieClip && preloaderMovieClip != null)
    trace("Progress Completed (%): " + numProgressCompletePercent + "%");
    trace(progEvent.bytesLoaded + " Bytes of " + progEvent.bytesTotal + " is Loaded.");
private function ldrExternalPreloader_Complete(event:Event):void 
    if (showPreloader)
        if (preloaderMovieClip != null)
            preloaderMovieClip.visible = false;
        ldrExternalPreloader.removeEventListener(ProgressEvent.PROGRESS, ldrExternalPreloader_Progress);
    ldrExternalPreloader.removeEventListener(Event.COMPLETE, ldrExternalPreloader_Complete);

And I use it with the following line of code:
Preloader("Images/Previews/PC.png", mcContents.mcTransition.mcTransitionAni.mcLeftPreviews, true, mcPreloader, mcPreloader.txtDynProgressIndicator);

I only want to know if loading external pictures with this method interferes in the GUI/UI that the user is working in while in Adobe Flash Player or Adobe AIR, or not?
Posted 2-May-13 3:49am
Updated 7-May-13 3:46am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Load external pictures without interfering in the users' works
I can accomplish Multi-Threading with Adobe Flash Player (11.4+) using the recently added "Worker API."
However, I do not need Multi-Threading for what I'm trying to accomplish. "Loader" is asynchronous.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100