As3 :: Javascript - Flex - Send A Jpg Image As ByteArray

Jan 10, 2010

How to send a jpg image as ByteArray from as3 to javescript? And how to convert ByteArray to image in javascript?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Send A Bytearray Object To A Javascript Function?

Aug 11, 2009

I need to be able to send a bytearray object to a javascript function or a java method, but I was wondering if I could do it using XMLHTTPRequest.

import asfiles.encoding.JPEGEncoder;import flash.display.Bitmap;import flash.display.BitmapData;import flash.external.[code]...

So I have a video that plays stream from a webcam,I will click a button and take a picture. I encode that picture using JPEGEncoder then I store it in a ByteArray.How do I send that data over to either a javascript function or a java class?I don't want to use the navigateToURL (URLRequest) method because that will redirect my page.Is there a way to send the data to a function while still staying on the same page?For example, make a asynchronous call to a javascript function or java method?

View 1 Replies

JavaScript :: Upload ByteArray Image On Facebook With SDK

Apr 14, 2012

I'm trying to upload a photo on Facebook using Javascript SDK. In particular I generate a base64 encoded bytearray from my Actionscript3 app, I pass it to Javascript file using ExternalInterface, and from that I decode the bytearray and I try to upload to FB. But it give me this error:
{"error":{"message":"(#324) Requires upload file","type":"OAuthException","code":324}}

I tried to upload an image simply from url, and in that way it goes well! This is my Javascript code:
upPhoto:function(photo) {
var img = F.decode_base64(photo);
FB.api('/me/photos', 'post', {
message:'test',
fileName:'test',
[Code] .....

View 1 Replies

Php :: Flex - Send A FLV Format Data In ByteArray Using URLloader To A Script?

Dec 15, 2010

Im creating flash game that have the functionality to capture/record its gameplay that can be viewed later by the user, like a replay.

As for now Im already able to record the game and write it into a flv format in a ByteArray variable.

What Im working right now is how to send that ByteArray(the video file) to a php script and save it to a web server.

I've run into the URLLoader in flash where it can send the data and php will receive it thru the POST method. Unfortunately, the ByteArray containing the flv data must be first correclty encoded for php to read it. I figured this out from the example in the net where it does the same thing only that it is only sending a JPEG ByteArray instead of a FLV format using the JPEGENCODER.

Is there any existing class like the JpegEncoder for FLV format or any Video formats? Or any work around like creating the encoder my self?

here is my current code to send the ByteArray

//send byteArray to a php script
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;

[Code]....

View 1 Replies

ActionScript 3.0 :: Send And Receive Image In Flash Form Javascript?

Sep 20, 2011

I want to resize a image using flash resizer.java script browse and upload a image and send to flash resizer and flash resizer resize the image and send back to javascript.Is it possible to send and receive image from javascript and if yes then please let me know what I need to do on flash end and how i can make javascript accessible to my flash code.do i need to load my full sourse code or javascript done there job with SWF only. 

View 2 Replies

Flex :: Core ByteArray Image?

Sep 6, 2009

var myFile:File = new File("./test.jpg");
var myFileStream1:FileStream = new FileStream();
myFileStream1.open(myFile, FileMode.READ);[code].....

now how can i add byte variable to the canvas ? for example

var canvas:Canvas = new Canvas();
canvas.addChild(byte);

is it possible to add ByteArray to the canvas?

View 2 Replies

Flex :: Resizing Image From A Decoded ByteArray?

Oct 20, 2009

I am trying to display a bytearray as a resized image. The Image is displaying correctly, but the sizing is off. Let me explain.

First I have the image data encoded so I need to decode the image data

// Instantiate decoder
var decoder:Base64Decoder = new Base64Decoder();
// Decode image data

[Code]....

This works. The image is displayed correctly. However, if I hardcode the image (img) height the resized image is shown correctly, but within a box with the original image's dimensions.

For example, if the original image has a height of 300px and a width of 200px and the img.height property is set to 75; the resized image with height of 75 is shown correctly. But the resized image is shown in the upper left corner of the img container that is still set to a height of 300px and a width of 200px. Why does it do that? And what is the fix?

The best way to illustrate the problem is by placing the image inside a VBox and show the borders of the VBox. From the code block above, if I change the image height and set the image to maintain aspect ratio (which by default is set to true but I add it here for completeness). the problem becomes clear.

// Display image
var img:Image = new Image();
img.height = 75; // Hardcode image height (thumbnail)
img.maintainAspectRatio = true;

[Code].....

View 1 Replies

Flex :: Have Image Bind To Bytearray Rather Than Bitmapasset Or Bitmap

Feb 15, 2011

I have an object that stores the compressed ByteArray version of an image (jpg or png). I want to keep it that way as the bytearray is about 30x smaller than the Bitmap it creates. The problem I run into is when I want to bind an image to this byte array. I can't really bind it to bytearray, because it requires a BitmapAsset as a source. Is there a way I can load a BitmapAsset from a bytearray but still bind to the bytearray when a new image is available?

View 1 Replies

Flex :: Get ByteArray From External Asset Image Synchronously

Oct 22, 2011

I have a var that holds the String value for the path to an image. How can I use that to get the ByteArray from that image synchronously?

View 1 Replies

Image :: Flex Working With Images (converting From And To Bytearray)?

Jan 28, 2012

I'm having a task in which I have to read and save images in the database.I'm using C#.net Webservice and SQlserver2008 database and I'm saving image as varbinary format.How I can read images from local system and convert it into byte array in Flex ?How to show images in Flex that are recieved in type Bytearray?

View 2 Replies

Send A ByteArray To FMS?

Sep 23, 2011

Who knows how to send a ByteArray to FMS?

View 1 Replies

ActionScript 3.0 :: Send Both Bytearray And Form Data?

May 11, 2010

I'm currently working on a small project. The user is supposed to draw/do a puzzle within flash, and also fill out a form with his details and comments.

When clicking the send-button, the image should be sent along with the form as an email.

I already know how to send the image as an email via php, and I know how to send a form as an email via php, BUT - I can't seem to do it together.

I've googled a bit and I found out that I cannot pass both the bytearray (from the image) and the form-data as URLVariables at the same time.

One way I got it to work is by passing the values from the form-data as a part of the URLRequest (and then use $_GET in the .php-file), but this has limitations as it can only pass 100 characters. As the user should be able to comment on his work, using GET with its limitations isn't an option.

View 2 Replies

Php :: Send An Actionscript ByteArray As A POST Variable (within Facebook)

Dec 18, 2010

I would like to use Flash to send a ByteArray (of a PNG image) to a php file, in a facebook application. Is there a way to do this by sending the ByteArray as just one POST variable instead of as the entirety of the POST data?

There was a nearly identical question here: How can I send a ByteArray (from Flash) and some form data to php? but the problem is different; instead of smuggling other variables in other parts of the request, the image itself has to be sent as just a variable because Facebook commandeers the post data and puts in its own junk.

If not, can I send the image in some form other than a byteArray?

View 2 Replies

ActionScript 3.0 :: Send ByteArray To Flash Without Using Php_amf Extension

Oct 3, 2010

I'm working on a Flash tool that needs to send some data in the form of a flash.utils.ByteArray instance to PHP (amfphp service class) and get that data back from the amfphp service as flash.utils.ByteArray instance. Now I can do all of these with the php_amf extension enabled on the local WAMP server. And the tool works fine. But how can I achieve this without the php_amf extension? I'm deploying on a shared hosting server and I don't have access to the php.ini and also the dl() function of PHP is disabled for security reason. With the extension disabled, I can send the ByteArray instance to PHP and save the data to DB. But the problem arises when I try to retrieve the data from DB, create a ByteArray instance (amfphp helper class) with the data and send back to Flash. I'm guessing here that proper AMF message is not being constructed because of the absence of the php_amf extension.

View 1 Replies

Php :: Send More Than One 'stream' Of Jpeg ByteArray Data In A Single URLRequest And Output 2 Images?

Jan 25, 2011

I have an AS3 swf which users can upload jpg images to my EC2 instances which sit behind and Elastic Load Balancer. The jpg images are converted into bytearray data and sent using URLLoader.load(URLRequest)I make 2 calls when uploading, one to upload a large version, then another to upload a thumbnail version. A PHP script to which the bytearray data is uploaded converts this to a file using file_put_contents($destination,$GLOBALS["HTTP_RAW_POST_DATA"])Is it possible to combine these two requests into a single request which contains both the bytearray data for the large and thumbnail images and 'split' the HTTP_RAW_POST_DATA to create 2 files at the server. This would be better than uploading the bytearray for the large version then using something like ImageMagick to resize the resulting image into a thumbnail which I realise is another option.

View 1 Replies

Flex :: Resize Image And Send To Server In Air App?

Apr 2, 2011

I'm trying to build an Air application where a user can drop in an image. That image needs to resize if it's bigger than 1024px 1024px.

What's the best practice for resizing an image in Air development? And what's the best practice if I want to send this to codeigniter amf server in Air 2.0, bytearray format?

View 1 Replies

Flash :: Arrays - Passing Audio Data ByteArray To Javascript?

Sep 7, 2011

I'm able to record sound with a Flash application embedded in my website, this audio is saved to a ByteArray, which I need to pass to Javascript in order to post to my server along with other required data.

I know I can use AS3 ExternalInterface class to communicate with Flash from Javascript, but what would be the appropriate format or variable type in javascript to hold the ByteArray, and how can I ensure that I won't lose much audio data when doing so?

View 1 Replies

Browse An Image And Then Send It To Data Base Using Flex And Webservice Java

May 4, 2011

want to browse an image and then send it to data base using flex and webservice java

View 2 Replies

Javascript :: Image Editor Component In Flex?

Sep 12, 2009

I'm looking for a simple Flex or JavaScript based image editing component which can be embedded in a web application. It shouldn't be a web service but rather a component that I can download and customize (i18n etc.).I only need some basic features: most important is cropping, optional features would be rotating and adjusting brightness/contrast

View 4 Replies

Javascript :: Bing Image Search Like Endless Scroll In Flex?

Mar 19, 2010

I want to know if there is any existing implementation of 'endless scroll' in Flex ? I searched online but I could only find implementation in Javascript.What could be the pros/cons of having an 'endless scroll' component in Flex, which would be more efficient JS or Flex.

View 1 Replies

Ruby :: Image/ByteArray To SVG Conversion?

Nov 12, 2009

I am wondering if it is possible to get a url to some image on google, say a square (jpg/png/gif), and process it into an SVG. Is this possible?

Right now I'm getting ByteArray data in Actionscript by making a URLRequest('image/on/google'), with dataFormat="binary". I don't think Actionscript could handle/do it, but maybe it could. I'm also good with Ruby, so perhaps is this possible with Ruby?

If so, any sample code/libraries to get started?

I guess another way to ask it is, how do I convert a Bitmap to a set of Vector Paths like Adobe Illustrator does?

View 3 Replies

Actionscript 3 :: Getting Image Size From ByteArray?

Oct 25, 2011

I am wondering if there is any way to determine the width and height of an image that is decoded to a ByteArray.For example in the below, any way to determine these values for data?

var data:ByteArray = new ByteArray();
data = encoded_image.decode(byteArrayData);

View 1 Replies

ActionScript 3.0 :: Get Image Dimension From ByteArray?

Nov 1, 2010

I have problems with the load of an image from a ByteArray, I can't get the image size, witch I need to position the image. Strange thing is that the image is showed to me correctly.

My code is something like this:

ActionScript Code:
var data:ByteArray; //Here are saved the raw image data (JPG, PNG, etc)
...
var img:Loader = new Loader();
img.loadBytes(data);

[Code].....

View 9 Replies

ActionScript 3.0 :: Getting Image Dimensions From The ByteArray

Aug 19, 2011

I have been searching in forums and I couldn't find an answer so I thought maybe I should ask.

I wrote a script that allows user to select a local file, which gets resized if it exceeds the width/height limits I specified, and finally this file gets uploaded to the server.

In documentation it writes the same max sizes for BitmapData and Loader:

Quote:

In AIR 1.5 and Flash Player 10, the maximum size for a loaded image is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a loaded image is 8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels in height and 2,880 pixels in width.

So what I need is to check the file size (width and height) before I attempt to load the bytes of the file into a loader. I'm limited to the ByteArray that I get by the load of the file via a FileReference instance.

Has anybody seen a source where you can get that data out of a ByteArray prior to loading it into a DisplayObject?

View 1 Replies

ActionScript 3.0 :: ByteArray To Server-side Image

May 22, 2009

I'm capturing an image from an swf and transmitting it as a byteArray to a php file. Everything seems OK in capturing and sending the data but the final image doesn't display and says it is corrupt.

I'm not sure if i need to do something to the byteArray or if there is something wrong on the php side that is causing the error?

I'm using stuff I've found on other posts and haven't tried JPGEncoder yet which is mentioned in some of those posts and examples. I thought it would be simple enough if it was just a getPixels() and wouldn't need JPGEncoder.

here is my AS3 code:

PHP Code:

// owl is mc with image on stage
var bitty:BitmapData = new BitmapData(owl.width, owl.height);
bitty.draw(owl);
//

[Code].....

View 14 Replies

Actionscript 3 :: Get Bytearray Data From Image That Is Under Certain Shape

Oct 19, 2010

How can I get the bytearray data from an image that is under certain shape, for example a circule or square?Let's say I want to modify ONLY the pixel inside this circule, how can I get this Bytearray data?

View 1 Replies

Flash :: Fetch The ByteArray Of The Image With Filter?

Jan 4, 2012

I am using pixel bender's pbj files(as recommended with Flex4) to change the brightness/contrast of a image.So i apply the filters to the image like this:

image.filters = myBitmapFilter;

Now my problem is how to fetch the byteArray of the image with filter applied so that i can send bytearray to my servlet which can save the image with applied effects.

View 1 Replies

ActionScript 3.0 :: Capturing An Image BitMapData In ByteArray

Dec 19, 2010

I'm trying to grab the BitMapData from an Image, convert it to JPG, and send it to a server where it will be written to a file. It "looks" like it works, the resulting .jpg is the right size and displays in an image viewer, but there is no picture... just an off-white background. Here's a code snippet:

imgTemp.addEventListener(FlexEvent.UPDATE_COMPLETE , imageLoadedHandler);
...
private function imageLoadedHandler(event:Event):void {
if (imgTemp.width == 0) return;

[Code].....

Then send "ba" to the server where it's written as a .jpg.

The data "looks" right when I receive it on the server, correct length, bits look the same.

View 7 Replies

ActionScript 3.0 :: Converting Image Into A Readable ByteArray?

Jul 19, 2011

I'm trying to read out some BitMapData into some kind of readable output.

Reason for this is I'd like to trace out the ByteArray and hopefully cut and paste its details into an .as file and then compare it against another BitMapData Object or byteArray that is generated within the app.

Basically I want to compare differences between the two and report back how many pixels or something are different.

It might seem like a strange or approach.

I can create a BitMapData Object, it traces back as [object BitMapData] - so I thought awesome just loop through the Object... But looping through the Object traces nothing at all back out.

So I tried to create a ByteArray and then convert that to a string, but all I get is wierd 'y' chars with two dots on the top of the char.

I've left some code below,

Code:
public function GetAndCompareBitmapData(target:DisplayObject) {
var bd:BitmapData=new BitmapData(target.width,target.height);
trace("bitmapData "+ bd); // trace [object BitMapData]

[Code].....

View 8 Replies

ActionScript 3.0 :: Upload ByteArray As Image To Server?

Mar 7, 2012

I'm trying to snap a bitmap image from within my application, and upload the bytes directly to my server to save as an image. I'm trying to same three separate images, three different sizes. I am able to do it twice, but as soon as it tries to save the third image, it throws a 2176 error...

ActionScript Code:
var url:String = 'myUploadURL';
var request:URLRequest = new URLRequest(url);
request.contentType = 'multipart/form-data';

[Code]....

I've tried a 3rd party class which wraps the byteArray and sends the data. This too works the first two but not the third.

Is it because I start by calling a function on mouseClick, that snaps the first bitmap then uploads, then snaps the second and uploads, then snaps the third and by the time it tries to upload, Flash assumes the function is 'too far away' from the mouseClick, and doesn't think it comes from user interactivity?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved