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
Similar Posts:
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
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
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
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
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
Aug 10, 2009
if someone presses ctrl +alt +delete or any kind of shutdown hook from any os and delete the flex process from task manager then how can i track from that flex process application that killing that flex process was activated so i like to do some processing before killing this process.
View 1 Replies
May 25, 2011
I want to open/convert a class in Flash that has was build for Flex. Now there are includes like StringUtil wich are easy to rewrite and others like bitmapasset which are not found.Is it possible to add the core classes of flex to my classpath?
View 1 Replies
Mar 23, 2010
Why is it that the mx.core.Container uses its contentPane sometimes, but doesn't at other times?Or, in other words, how come the children of Container are only put into the contentPane if some complex logic decides that they should be put there? Why not simply always put all children in the contentPane?
View 1 Replies
Jun 3, 2009
I am trying to create a large flex project. This Project consists of a CORE application, and other sub-applications.The CORE application should contain information that will be shared by all other projects (e.g., link to database, data manager which loads data from the database, application information like height width colors fonts... etc.).
The sub-applications each has a certain task. Each sub-application is a large project by itself so I don't think its a good idea to put all code inside one HUGE project.The CORE project should run the main application, and through a navigation menu, I should be able to click and run other sub-applications.Is there a way to created the CORE application to reference those sub-applications so that I can run them inside of the CORE. At the same time, those sub-applications should reference the CORE applications to get the NetConnection to the database and other important information that they might share?
View 3 Replies
Sep 7, 2010
I'm trying to load a module into a flex 4 application (the module was compiled using SDK4 as well) but I got this error (I'm migrating this app from Flex 3 to Flex 4):
VerifyError: Error #1014: Class mx.core::LayoutContainer could not be found.
at flash.display::MovieClip/nextFrame()
at mx.core::FlexModuleFactory/deferredNextFrame()
at mx.core::FlexModuleFactory/update()
at mx.core::FlexModuleFactory/moduleCompleteHandler()
[code]....
View 2 Replies
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
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
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
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
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
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
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
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
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
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
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
Dec 13, 2010
i try to get a bytearray from a webcam. i can get the image of the webcam, copy it to bitmapdata and get the bytearray. but is it possible to get the bytearray from the image and sound from the client's webcam?
View 2 Replies
Nov 13, 2011
i like to ask about one thing If i create Loader and load external image by URLRequest , ill have result :
loader.content is Bitmap loader.content.bitmapData is BitmapData But if I use Loader.loadBytes(ImageBytes) , result is different even if ImageBytes is loader.contentLoaderInfo.bytes :
bytesLoader.content is MovieClip
bytesLoader.content.getChildAt(0) is BitmapData
bytesLoader.content.getChildAt(0).bitmapData is BitmapData
View 1 Replies
Feb 4, 2009
I pass an image ByteArray to PHP.Along with the image ByteArray I would also like to pass a single string variable to the same PHP script.[code]
View 2 Replies
Feb 13, 2009
I want to load an image from a ByteArray and then set the dimension of the image. I'm doing it in the following way.
var img:Image = new Image()
img.load(byteArray);
img.width = 200;
img.height = 200;
The problem is that if my original image is for example 90x100, I would get displayed an image of 180x200. It seems it cannot modify the proportion of the image! How can I instead obtain a 200x200 image?
View 0 Replies
Feb 16, 2011
I am working on a game, made with Flash (using AS3) The game has a fast ball and when this ball hits an object it has to make a sound... but the sound starts with delay (so the ball is far away when the sound is played).This sound is edited by me and it hasn't got any silences at the beginning.The method i'm currently using is the simplest one:
public var sonidoPuntos1:sonidopunto1 = new sonidopunto1()
and then...
sonidoPuntos1.play()
I am trying to introduce the file into a ByteArray and then playing it from there...
View 2 Replies
Nov 29, 2010
I've been playing with the Jpeg encoder now for a while and haven't come much further than just realising how to turn an image into a ByteArray of numbers. The code below is incredibly useful at turning a movieclip on the stage into a Jpeg and downloading it to the user. Unfortunately I need to amend the Bytearray first with a crop tool before creating the jpeg. e.g. delete the array value if the image is outside of the rectangle? And a rotate tool, e.g. all the values in the array switch places 90 degrees!? (the X and Y values switch over).Also it downloads to the user, but I need it to save onto the server so I can keep using it in flash, before then emailing the jpeg to a known email address.
(E.g. if a 10px x 10px bitmap, would have 100 values in the array, to crop it into a 5 x 5 image, I would delete array entries
where X < 2 and X > 7
and Y < 2 and Y> 7.
Or to rotate it, X for 1st pixel becomes the Y for the 1st pixel and vice versa)....
ActionScript Code:
import com.adobe.images.JPGEncoder;
import flash.net.URLRequest;
import flash.display.BitmapData;
import flash.utils.ByteArray;
import flash.net.URLLoader;
[Code] .....
View 2 Replies
Dec 21, 2010
I work on a Flex application that creates compressed files and uploads them on a server. The files are created with ByteArray.compress method, which is zlib compression. I can decompress them using Python API on the server but I prefer to keep the files compressed there. I want to be able to download and decompress the files later, however WinZip and WinRar fail to decompress them. When I google for zlib utility, I only find zlib dll library. I need a simple application for Windows (and/or Linux)
View 1 Replies
Mar 25, 2010
The data provider (ArrayCollection) for my data grid consists of objects with ByteArray (int) fields. How do I make the data field display as int without transforming my data provider?
View 1 Replies