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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:38:06+00:00 2026-06-04T06:38:06+00:00

I have the following AS3 code which converts a bunch of BitMap screenshots to

  • 0

I have the following AS3 code which converts a bunch of BitMap screenshots to jepgs following a user request. (sourceArray stores the original bitmaps).

for (var i:int=0; i<sourceArray.length; i++)
    {
    var jpgEncoder:JPGEncoder = new JPGEncoder(10);
    var jpgStream:ByteArray = jpgEncoder.encode(sourceArray[i]);
    var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");     
    var jpgURLRequest:String = new String("videoprocess.php?name=drawing" + i +".jpg");
    jpgURLRequest.requestHeaders.push(header);
    jpgURLRequest.method = URLRequestMethod.POST;
    jpgURLRequest.data = jpgStream;
    ExternalInterface.call("openWindow", jpgURLRequest );

My PHP code to save these jpegs is as follows:

 <?php
 if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ) && isset ( $_GET['name'] ) ) {

//the image file name
$fileName = time();

// get the binary stream
$im = $GLOBALS["HTTP_RAW_POST_DATA"];

//write it
$fp = fopen($fileName, 'wb');
fwrite($fp, $im);
fclose($fp);
}
?>

Using the externalinterface.call call above, I’m trying to pass individual jpegs to the PHP file for saving on each turn of the loop, but so far I’ve been unable to pass the jpgURLRequest as an object. Would anyone be kind to enough to shed light on the JS code which would be needed to pass the jpeg from AS3 to PHP? Many thanks.

  • 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-04T06:38:08+00:00Added an answer on June 4, 2026 at 6:38 am

    I dont see why you would want to use Javascript to pass the binary data from Flash to PHP. You ca do that from as3 using URLLoader and URLRequest and setting the method to “post”. The code you should add looks like this:

    var urlRequest = new URLRequest(jpgURLRequest);
    urlRequest.method = URLRequestMethod.POST;
    urlRequest.data = jpgStream;
    urlRequest.requestHeaders = new Array(header);
    var urlLoader = new URLLoader();
    urlLoader.load(urlRequest);
    //depending if you want to do something with the response you can add event listeners
    

    Hope it helps.

    UPDATE
    If you want to send the requests in order you should start by defining a global variable: var index:int=0 and define a function:

    function loadSource() {
    var jpgEncoder:JPGEncoder = new JPGEncoder(10);
    var jpgStream:ByteArray = jpgEncoder.encode(sourceArray[index]);
    //... rest of your code here  
    var urlRequest = new URLRequest(jpgURLRequest);
    urlRequest.method = URLRequestMethod.POST;
    urlRequest.data = jpgStream;
    urlRequest.requestHeaders = new Array(header);
    var urlLoader = new URLLoader();
    urlLoader.load(urlRequest);
    urlLoader.addEventListener(Event.COMPLETE,completeEventListener);}
    
    function completeEventListener(e:Event)
    {
      index ++;
      if (index<sourceArray.length) loadSource();}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following as3 function below which converts normal html with links so
I have the following code to create a ViewStack which is used as a
I have the following code in AS3: var str:String = '<TEXTFORMAT LEADING=2><P ALIGN=LEFT><FONT FACE=Arial
I have a problem with the following Flash AS3-code: When I change Delete1 to
I have the following code (AS3 & CS 5.5): var regEx:RegExp = new RegExp(/(?:^|\s)(\#[^\s$]+)/g);
I have the following array as3 example: var arrayDefinitionsargsAmfPhp:Array = new Array(); arrayDefinitionsargsAmfPhp['tabela'] =
I have the following two projects in in Flex Builder 3: One AS3 library
Hey all, basically i have an empty AS3 fla file with just the following
I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
I have following code in my application: // to set tip - photo in

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.