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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:34:35+00:00 2026-05-22T17:34:35+00:00

I have to convert a MovieClip to ByteArray and send it to php using

  • 0

I have to convert a MovieClip to ByteArray and send it to php using the POST method. The person handling php says that only ByteArray needs to be send and conversion to JPG and PNG can be done from PHP side. When I built the option for saving on the local machine the following steps were used.

  1. Converting to Bitmapdata
  2. Using JPGEncoder and PNGEncoder on the Bitmapdata
  3. Then assiging to byte array variable.

So in this case different byte arrays were used for saving in case of JPG and PNG and it worked.

I found the code to convert movieclip to bytearray in Stackoverflow itself

AS3: Export a MovieClip or Canvas to swf

var buffer:ByteArray = new ByteArray();
buffer.writeObject(MOVIE_CLIP_HERE);
buffer.position = 0;
buffer.writeBytes(...);

What should be the parameter of writeBytes function of buffer object. Assume that the name of the movieclip is canvas_mc.

I have figured out the php part already. Thanks in advance.

  • 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-22T17:34:36+00:00Added an answer on May 22, 2026 at 5:34 pm

    You don’t use ByteArray.writeObject() and parse a MovieClip..

    You need to use bitmapData.getPixels() which returns a ByteArray representing the pixels of your bitmap.

    Here’s a quick example:

    const WIDTH:uint = 100;
    const HEIGHT:uint = 100;
    
    var rect:Rectangle = new Rectangle(0,0,WIDTH,HEIGHT);
    
    // create BitmapData
    var bmd:BitmapData = new BitmapData(WIDTH,HEIGHT,true,0);
    bmd.draw(YOUR_MOVIE_CLIP);
    
    // your byte array
    var ba:ByteArray = bmd.getPixels(rect);
    trace(ba.length);
    

    Basically what you want to do is use BitmapData.draw() to get your MovieClip graphics and store them as a ByteArray.

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

Sidebar

Related Questions

I have to convert an incoming String field into a BigDecimal field that would
I have to convert a decimal number to octal and hexadecimal using bitwise operations.
I have binary data in my database that I'll have to convert to bitmap
I have a RTP video stream that I want to send to a set-top
I have a convert method, which takes a String and a class as arguments
I have an app that is built from Flash CS5.5, exported using AIR3.1 and
I currently have a vertical slider that is controlled by the user using startDrag.
I have to convert a MSSQL stored proc that passes a varchar that is
I have to convert some C code (that ran in a Linux machine) to
I have to convert all my echo/print string from my php source code file

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.