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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:52:59+00:00 2026-05-13T10:52:59+00:00

I have a weird issue. I can get Event.COMPLETE to fire when I set

  • 0

I have a weird issue. I can get Event.COMPLETE to fire when I set

image.source = byteArray;

BUT

When I manipulate the byteArray – convert it to Bitmap and use image.source or image.load to load it, the bitmap gets loaded properly into the Image component; BUT Event.COMPLETE never fires. What might be wrong here? I have added an event lister for complete too! My source is as follows:

                var bmp:Bitmap = scaleBitmapData(bitmapData,280,220);
                imgPreview.addEventListener(Event.COMPLETE,onPreviewImageCompleted); // never fires
                imgPreview.visible = false;
                imgPreview.load(bmp); // does not work with .source either; image is displayed but Event.Complete never fires!

Thanks
Subrat

  • 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-05-13T10:52:59+00:00Added an answer on May 13, 2026 at 10:52 am

    So the class in play here is SWFLoader (Image extends SWFLoader). If you passed in the ByteArray or a url than it adds the appropriate listener. What you’ve done is fed it a Bitmap, which is a display object. Here is the important code that is loading a Bitmap into an Image:

     else if (classOrString is DisplayObject)
     {
         contentHolder = child = DisplayObject(classOrString);
         addChild(child);
         contentLoaded();
     }
    

    ByteArray:

    else if (byteArray)
    {
        loader = new FlexLoader();
        contentHolder = child = loader;
        addChild(child);
    
        loader.contentLoaderInfo.addEventListener(
            Event.COMPLETE, contentLoaderInfo_completeEventHandler);
        loader.contentLoaderInfo.addEventListener(
            Event.INIT, contentLoaderInfo_initEventHandler);
        loader.contentLoaderInfo.addEventListener(
            IOErrorEvent.IO_ERROR, contentLoaderInfo_ioErrorEventHandler);
        loader.contentLoaderInfo.addEventListener(
            Event.UNLOAD, contentLoaderInfo_unloadEventHandler);
    
        // if loaderContext null, it will use default, which is AppDomain
        // of child of Loader's context
        loader.loadBytes(byteArray, loaderContext);
    }
    

    a url:

    else if (url)
    {
        // Create an instance of the Flash Player Loader class to do all the work
        loader = new FlexLoader();
        contentHolder = child = loader;
    
        // addChild needs to be called before load()
        addChild(loader);
    
        // Forward the events from the Flash Loader to anyone
        // who has registered as an event listener on this Loader.
        loader.contentLoaderInfo.addEventListener(
            Event.COMPLETE, contentLoaderInfo_completeEventHandler);
        loader.contentLoaderInfo.addEventListener(
            HTTPStatusEvent.HTTP_STATUS, contentLoaderInfo_httpStatusEventHandler);
        loader.contentLoaderInfo.addEventListener(
            Event.INIT, contentLoaderInfo_initEventHandler);
        loader.contentLoaderInfo.addEventListener(
            IOErrorEvent.IO_ERROR, contentLoaderInfo_ioErrorEventHandler);
        loader.contentLoaderInfo.addEventListener(
            Event.OPEN, contentLoaderInfo_openEventHandler);
        loader.contentLoaderInfo.addEventListener(
            ProgressEvent.PROGRESS, contentLoaderInfo_progressEventHandler);
        loader.contentLoaderInfo.addEventListener(
            SecurityErrorEvent.SECURITY_ERROR, contentLoaderInfo_securityErrorEventHandler);
        loader.contentLoaderInfo.addEventListener(
            Event.UNLOAD, contentLoaderInfo_unloadEventHandler); 
    ...[this goes on for awhile]
    

    So you get the gist here. Don’t convert it to a Bitmap and you’ll get your complete event. You could also add ADDED_TO_STAGE to your Bitmap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not sure what is going on, but i get this weird issue
I have a weird issue that only seems to be affecting IE 7. The
We have a semi-weird issue for our site. Consistently, from 1 anonymous* user the
I have a weird date rounding problem that hopefully someone can solve. My client
I have a weird issue (weird because it is specific to one component) with
I have Magento 1.3.2 and I have weird issue: When I am in list.phtml
Having a weird issue. I'm new to Macs and have a windows VM that
Im having a very weird issue. I have a normal ajax call that upload
I have a weird problem and I would like if someone can enlighten me
I have a weird error in my C++ classes at the moment. I have

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.