Click here to Skip to main content
11,718,589 members (77,566 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Flash Flex
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);
        trace("**************************************************");
    }
    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)
    {
        preloaderMovieClip.gotoAndStop(numProgressCompletePercent);
    }
    trace("Progress Completed (%): " + numProgressCompletePercent + "%");
    trace(progEvent.bytesLoaded + " Bytes of " + progEvent.bytesTotal + " is Loaded.");
}
 
private function ldrExternalPreloader_Complete(event:Event):void 
{
    pictureHolderMovieClip.addChild(ldrExternalPreloader);
 
    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
MRS1989840
Edited 7-May-13 3:46am
v5

1 solution

Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 651
1 OriginalGriff 210
2 F-ES Sitecore 185
3 Jochen Arndt 160
4 Maciej Los 130
0 OriginalGriff 535
1 Maciej Los 529
2 Richard MacCutchan 440
3 CHill60 415
4 F-ES Sitecore 415


Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2015
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