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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:59:19+00:00 2026-06-01T14:59:19+00:00

I have a Flash / Actionscript 3 based desktop app wrapped in an *.exe

  • 0

I have a Flash / Actionscript 3 based desktop app wrapped in an *.exe using Zinc 4.0. I am using Flash Pro CS5.

I need to start saving very large image files locally. I have messed around with JPG Encoding these images before saving them to a local file via Zinc. I solved the actionscirpt timeout issue using This “asyncronous like” method. Encoding a 1.5 MP image takes about 5 seconds which is alright, but encoding an 8 MP image file takes about 40 seconds, which is not acceptable.

One idea I had is to save the BitmapData locally to a temporary Bitmap file (*.bmp), without having the end user to wait for JPG Encoding in Flash, and then use my already existing image processor (written in C#) to read the bitmap file and encode it without waiting on Flash to do it, effectively offloading the task away from the user.

I have used BitmapData.getPixels() to try and write the byte array directly to the file, using the same Zinc method as I do successfully with encoded JPGs, but the *.bmp file is unreadable. Are there some file headers that would need to be included in addition to the BitmapData getPixel()’s byte array to successfully save a bitmap image? If so how could I successfully add them to the byte array before writing to file?

Any guidance, clarification or other solutions much appreciated.

  • 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-01T14:59:20+00:00Added an answer on June 1, 2026 at 2:59 pm

    I’ve found a solution for my needs, and just in case others have similar needs:

    To save an actual Bitmap (*.bmp) file, Engineer’s suggested Btimap encoder class was awesome. Very fast on the actual encoding; however, since my file writing call in Zinc is synchronous and bitmap files are a lot larger than JPGs it really just moved my bottle neck from encoding to the file saving, so I decided to look elsewhere. If Zinc had an asynchronous binary file writing method that would not lock up the GUI I would have been happy, but until then this is not the solution for me.

    I stumbled across a Flash Alchemy solution, with great results. Instead of waitint abour 40 seconds to encode an 8 MP image, it now only takes a few seconds. This is what I did:

    1. Downloaded the jpegencoder.swc from this page and saved it in my project directory
    2. Added the swc: Publish Settings > Flash (tab) > Script: Actionscript 3.0 “Settings…” button > Library path (tab)> and added that .swc with Link Type = “Merged into code”
    3. Then used it :

    (below is my modified code with just the basics)

    import flash.utils.ByteArray;
    import flash.display.BitmapData;
    import cmodule.aircall.CLibInit; //Important: This namespace changed from previous versions
    
    var byteArrayResults:ByteArray; //Holds the encoded byte array results
    
    public static function startEncoding(bitmapData:BitmapData):void {
    
        var jpeginit:CLibInit = new CLibInit();     // get library
        var jpeglib:Object = jpeginit.init();       // initialize library exported class to an object
    
        var imageBA:ByteArray = bitmapData.getPixels(bitmapData.rect);  //Getpixels of bitmapData
        byteArrayResults = new ByteArray();
        imageBA.position = 0;
        jpeglib.encodeAsync(encodeComplete, imageBA, byteArrayResults, bitmapData.width, bitmapData.height, 80);
    }
    
    private static function encodeComplete(thing:*):void
    {
        // Do stuff with byteArrayResults
    }
    

    You may find this link useful as well:
    http://last.instinct.se/graphics-and-effects/using-the-fast-asynchronous-alchemy-jpeg-encoder-in-flash/640

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

Sidebar

Related Questions

I have a pure Actionscript 3 project, using flash.* libraries, compiles down to about
I'm using the following ActionScript for my Flash preloader, what this does is have
I have a simple ActionScript 2-based flash file where I'm doing all of the
I'm working on a Flash based networked game. I have to choose between ActionScript
So this doesn't make any sense. I have actionscript in a flash-based button menu,
I am rather new to flash/actionscript and I have encountered a problem. I need
I have a flash (ActionScript 3.0) which uses socket connection to send data to
I have a Flash movie which has a number of actionscript 2 functions which
I have two noobish questions about Flash, Actionscript, Flex etc. 1) With these technologies
I have some experience of developing in Flex/Actionscript using Cairngorm framework. At that time

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.