Im currently trying to work the imageSnapshot function in flex. Ive been looking hard but I cant seem to find a solution to my problem. I wish to take a screenshot of one of my components, to capture the final output of my program, since a plain "printscreen" cuts off some of the output due to it scrolling. My current code looks like -
<mx:ApplicationControlBar dock="true">
<mx:Button label="Take snapshot of Profile"
click="takeSnapshot();" />
[Code]....
Now i think this is taking the image of the viewstack which I want... But Im stumped on what to do from here! Is it not possible to now just copy the image to the clipboard, or produce a new window in my browser with the entire image inside?
I made a program in Flex that uses the actionscript 3 drawing api. I am drawing on a Canvas and on every mouseUp event I save the bitmapData in an Image component and clear the the Canvas. That works great, but the problem appears if I want to add a background to the paint that was drawn.
Here are the mxml components: Code: <mx:Canvas id="_backgroundColor" width="100%" height="100%" x="0" y="0" /> <mx:Image id="_image" x="0" y="0" mouseEnabled="false" /> <mx:Canvas id="_paper" x="0" y="0" />
And here it is the function I have on the Canvas (_paper) mouseUp Code: private function onSaveModifications(evt:PaperEvents):void{ var bmpData:BitmapData = new BitmapData(this._paper.width,this._paper.height,true,0x00FFFFFF); bmpData.draw(this._paper); this._image.source = new Bitmap(bmpData); this._paper.graphics.clear() }
I want when I set the _background Canvas background color to see it, but I cannot because the Image component(_image) where I save the bitmap is masking it.
This is how I set the background Code: this._background.setStyle("backgroundColor",0xff0000) Do you know how can I make the pixels of the bitmap that weren't drawn to be transparent?
I have an image loaded from an url and added to canvas as child. Then I am drag and dropping another image on it which also uses the senocular transform so the image can be transformed on the canvas. I have coded in such way that the transform handles shows up only after it's dropped on canvas. The image shows up correctly. But I am trying to save the result image (that is the main image and the dropped image on top of it), I only end up with the main image that was loaded earlier. The dropped image doesn't show up.
Below is the code for handleDrop() that is fired on dragDrop event and prepares the final image.
I load image to control than I applie some effects, and when I save image it's saving without effects. What should i do?
Here is the code:
private var byteArr2:ByteArray; private var fileRef:FileReference = new FileReference(); public function process():void
[Code].....
UPDATE Appears new problem as I am using var data:BitmapData = new BitmapData(currImg.width, currImg.width); saved image is small(size like image control) but I need to save image with original size. With var data:BitmapData = Bitmap(currImg.content).bitmapData; it worked
I'm currently working on a chat with uploading an image and sharing it. The problem is I can upload and display the image but I can't share it to the other side. Here is some code:
I need to be able to save and load images into an SQLite database using Flex 4.5 for a mobile application. The use case is this:
Inside the view there is a spark Image object with a URL as a source
When user clicks button, the Image is saved to an SQLite db inside a BLOB field.
In a separate Image, the source is set to the ByteArray stored in the db.
The biggest question so far is this: where do I get the ByteArray for a loaded Image? I've tried debugging and inspecting Image, BitmapImage, and BitMapData but there's no sign of the byte array.... perhaps it's inside the ContentLoader? But that's null unless I enable caching.
I've done some research and there are no complete examples for how to handle this. I've written a simple View that anyone can copy and paste into a new project. It will compile without errors and can be used for testing. I will update this code as I get the answers I need so that anyone can have a fully working example of this workflow.The only caveat: I used a synchronous connection to the DB to avoid complicating the code with event handlers, I wanted to keep it as simple as possible.I will only mark this question as answered once it is fully functioning both ways.
UPDATE SEPT. 09 2011: The code below is now fully functioning in both directions (save and load). Here are some of the things I've learned: It turns out that the ByteArray of a spark Image can be found inside the LoaderInfo of the image itself. Like this:
image.loaderInfo.bytes
However, trying to set this ByteArray as the source of another image ( image2.source = image1.loaderInfo.bytes) results in this security error: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.Which is too bad because it would save so much time and processing power.the workaround is to encode the ByteArray using either a JPEGEncoder or a PNGEncoder. I used the JPEGEncoder which produces much smaller files. Here's how:
var encoder:JPEGEncoder = new JPEGEncoder(75); var imageByteArray:ByteArray = encoder.encode(imageToSave.bitmapData);
Now the problem is saving these bytes to the DB. Saving them as they are now will not work once we read them out, I'm not sure why. So the solution is to encode them into a base64 string like this:
var baseEncoder:Base64Encoder = new Base64Encoder(); baseEncoder.encodeBytes(imageByteArray); var encodedBytes:String = baseEncoder.toString();
So now just save that string into the BLOB field and later read it out. However, you have to decode it from a base64 string to a ByteArray like this:
var encodedBytes:String = result.data[0].imagedata; var baseDecoder:Base64Decoder = new Base64Decoder(); baseDecoder.decode(encodedBytes); var byteArray:ByteArray = baseDecoder.toByteArray();
Now assign the bytearray as the source of your image and you're done. Simple right?if you find any optimizations or alternative ways to do this.I will respond and keep this code updated if need be.
How can I show an image that I have just captured with the webcam?I am able to save that image using PHP but before I save it, I want to show a preview. How can I do this? Here is a snippet of the code that I think can be used to do this:
ActionScript Code: foo = new BitmapData(640,480); foo.draw(myvideoobject, scaleMatrix);
I'm trying to put an image, generated from some text, in a RichEditableText. Since it's a styled text, I thought about putting it another RichEditableText, style it, then print it to a Bitmap to use as source for InlineGraphicsElement.I use the following code to do that
var txt:RichEditableText = new RichEditableText(); txt.text = name; // Appliy given styles to the text flow of input rich editable text
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
The project I'm working on requires older libraries that extend mx components (such as TitleWindow and TabNavigator), I can't use what I know about Spark skinning directly. However, since the project is being programmed using the default Spark theme (with my modifications on top) rather than the Halo theme, I apparently don't have access to the styles I need (namely backgroundImage and contentBackgroundImage which apparently require Halo to be active). Simply setting Halo to be the theme will break other things, not the least of which my own theme.
Plans are in the works to replace the older libraries or at least patch them better to Flex 4, but as of right now, I need a way to style/skin these components without modifying them directly. It would be ridiculous to be unable to add a background image to a TitleWindow's content area! I've searched the internet high and low all day and tried countless variations of styles, skins, selectors, and combinations thereof with no luck. How to add a background image to the content of a mx TitleWindow while using the Flex 4.1 sdk?!
In a component 'Group' I drag multiple pictures at one time I need to clean this component, but contains a component BitmapImage and I will not be erased:
I want to make for my fellow classmates. The idea is to have to lists with selectable items in each of them. And they are supposed to be tasks, one list with the "To Do" items, and one with the "Done" items. What I want is that the .swf can remember(save) what items I have moved from one list to the other from time to time.
Example: List1(To do list): * Homework [code]..........
and when I click on "Homework" and a button, it would go from list1 to list2(i have made this work).
List1(To do list): * Fix motorcycle * Clean the garage[code]........
But of course when I close the .swf, the lists would be reset until next time I open it.I was thinking of something with .xml files for each lists, so I would rewrite the .xml's when I transfer one thing from list1 to list2.
enter code hereI am loading an external swf into an component. It loads everything fine and I can see buttons working in the swf, I can add a movieclip to the but I can't then access that movieclip (or don't know how), and it keeps telling me numChildren = null when I try to trace it out. This is set up as a custom component like this:
I have found something good here. [URL]..The mouseover effect on the list item is good. Any ideas to make this look.. I can infer that this is happening on mouseover of the Image Component. I think this is similar to google image search preview of images. If anyone have come across a component similar to this kindly share it to me and to all.
My application consists of displaying a large custom tree like structure to the user that can eventually grow to massive proportions like the dimensions listed in the question. I allow them to export the image with the following line of code tied to a button click event:
var image:ImageSnapshot = ImageSnapshot.captureImage(this, 72, new PNGEncoder(), false);
I've managed to export images close to the dimensions listed but around there it start to get the error message listed below after spinning for close to 15 seconds:
Error: Error #1000: The system is out of memory. at flash.utils::ByteArray/writeBytes() at mx.graphics::ImageSnapshot$/mergePixelRows()
[Code]....
Is the flashplayer plugin for my browser running out of memory? I noticed in my task manager it got up to about 1.2GB of memory usage(I have 4GB on my system). If that is the case is it possible to limit the memory usage for a given function like the ImageSnapshot.captureImage() call above?
Is there maybe a way to generate the component into 2 or 4 ImageSnapshot objects and piece them together afterward?
I have a component "child" which has a cancel button. Now this component is placed in a state called "newChildComp" I also have another component called "parent". In the parent component, i have a button that dispatches an event. Here is the event code:
[Code].....
so, basically,i am checking to see if the cancel button component in the Child component, while i am still in the parent Compoent, was clicked, if it was clicked, call the cancelButtonHandler. The problem is by the time the addNewChild handles the event, that cancel button was still null. My question is how do i solve this without using the itemCreationPolicy on the cancel button?
I am trying to make a flash application that can save (to the user's local hard drive) a screen shot of the canvas (or more accurately part of it).I've dabbled with Quasimondo's Bitmap Exporter which did some funky stuff to render an image, ship it to a php script on the server, and bounce it back to the client. But not only is that inefficient it also has two other major flaws:
1) it's written in actionscript 2 so I can't use any actionscript 3 abilities.
2) it breaks as soon as one of the images on the stage is defined as a variable brought in through $_GET rather than hard coded. (the image comes in fine but then the rendered finished product is a blank white image)
I'm using sephorith's excellent export jpg with flash and php set up which can be found here:
[URL]
I have this working, taking a simple grab in my flash movie and finally displaying the image in the broswer as a jpg. This is all fine, however, instead of displaying the image in the browser, I want to just save it into a folder. I know very little php, but in the file provided, he uses the line:
[CODE] // print out the correct header to the browser header("Content-type:image/jpeg"); // display the image imagejpeg($img, "", 90);
I am working on a web-tool that allows users to add pre-loaded tiles of data as overlays to Google Maps. I then want users to be able to save their work. I'm approaching this as them saving a series of images that they can then import to work and add text etc to a layout they choose. If you want to see it in action, it's available here: [URL]
My issue is saving the map image.
I started by trying to use BitmapData.draw() and the JPGEncoder class in the as3corelib and this works for the 2 legend images. It also works for the map when testing on my PC (and changing the Global Security Settings). As soon as you put it on the server it hangs at the BitmapData.draw() line, and I've since found out that this isn't resolvable:
code.google.com/apis/maps/faq.html#bitmapdata
I went back to trying to use map.getPrintableBitmap (code.google.com/apis/maps/documentation/flash/reference.html#Map.getPrintableBitmap; which I'd previously discarded due to poor resolution). I can still pass this through JPGEncoder and am now happy with the result. However, the code only runs when no overlays have been added to the map.
Is it possible to save image from Flash with ActionScript3 without using of any server side script? I need the download image functionality on application distributed on a cd so I can't use any server side scripts.
change the following php/AS3 to make it save the dynamically created masked image to the server instead of offering it for download? You have to pass it variables from the as3 AT THE BOTTOM OF THIS POST...
PHP - <?php if(isset($_FILES['Filedata'])) { // basically if file data exists to actually upload.
I have a game where you can throw snowballs, get a score, and a accuracy at the end.I want to be able to let the use save the score to a jpg.The code works fine, image saves right to the computer.it get the movieclip.height and movieclip.width (which is about 300x 100 px)But when I look at the image it makes a 300x100 jpg image but puts every data thats being written in the top left corner.
I built an information terminal for the shop of a friend of mine which uns as fullscreen application.On this terminal the swf file is running as a stand alone file by unsing the flash player directly.I want to save a snapshot (jpg) from a webcam if someboy presses a button.This does work as long as I run my application (swf) by using the browser (Firefox , Apache and localhost).But if I try to use it as it should be used no image is beeing created.
There was an error when first testing the application which forwarded me to an Adobe site where I had the possibility to grant files permissions, which I did for the file (the SWF) that needed it.Did I do something wrong, or is there some permission thet I have to grant before it works as it should be?
I have a project where the user uploads a large 300dpi image, then manipulates it (drag it, rotate it, position it). And the user can reuse this 300 dpi image, basically to make something like a t-shirt pattern. Then when the user is ready, they save this t-shirt pattern, and the save format is a large 300dpi png. This saved png file is for printing. Now I figure I can have PHP take bitmap data (as binary I assume) and the php can create the png. Is it a good idea to use Flash for this? I will have to scale down the users loaded 300dpi image so they can position. Then I assume scale it back up when it comes time to save Does anyone think Flash can't handle this?
Is it posible to save a flash scene into an image and save it on client-side hard drive ? Without PHP. I dont care if user has to change flash security options.
I followed this question:flash Actionscript 3 and php image upload.I copied the code:[code]It works great, I just need to know how to save the image under a specific name, how do I pass an argument to the php script? or is that not necessary, can I change it before calling the script?How would I then call URLrequest to show user the file he uploaded ?