Flex :: Actionscript 3 - Saving Mx:image With Applied Effects
Jan 5, 2011
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
View 2 Replies
Similar Posts:
Oct 7, 2009
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?
View 3 Replies
Jun 10, 2011
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.
[Code].....
View 1 Replies
Jun 10, 2011
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:
[Code]...
View 1 Replies
Sep 8, 2011
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.
View 2 Replies
Mar 12, 2012
I am trying to generate image of flash charts generated by Open Flash chart library using PHP Mysql database.
I have generated image but it's in some coding format in a div on my webpage. Something like below:
<div id="img_chart_1">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAk4AAAEsCAYAAAA1jTw5AAAli0lEQVR42u3dDdAkdX0n8Keu6s67..../ >
</div>
How can I save this image in any image extension like .png ?
I have to give a button on my page. So when user click on button I have to export this image in PGF file.
So I am trying to save this image with image extension and will give link of saved image in PDF file to show.
View 1 Replies
Jan 31, 2009
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);
[code].......
View 3 Replies
Jun 23, 2004
can anyone point me in the direction of a script that loads as such on this website: url...
-go to "collection"
-click on the image and see how the images are broken into long rectangles that then builds itself up to form the complete image.
how is this done?where can i find the script if it is at all?
View 3 Replies
Jun 15, 2011
I have Flex application(not AIR) thats load image and perform some effects, application works well in flash builder and in the debug folder. But when I am trying to copy *.swf to another local folder, appears problems with image loading.
UPDATE You don't understand me, i am trying to load image from desktop using FileReference class, image shows successfully, but origBitmap after saveAsBitmap() method is null
public function loadImage():void
{
fileRef.addEventListener(Event.SELECT, onFileSelected); [code].....
View 2 Replies
Jul 4, 2005
Does anyone know of any good image effects that can be created with flash mx and photoshop?
One that comes off the top of my head is having an image be drawn in with an outline, then having it fill in with white and then have the full colour image fade in. Another is this one [url]...
View 10 Replies
Jul 24, 2006
I am working on an as3 slideshow class and I came across a blog post that gave me the idea to use better transitions than the sliding out and fading I originally intended to use. [URL]The source for that class is available and it is a good starting point but I wanted to check and see if anyone know of similar projects that had more effects. Right now I just have the random explode effect from the above link and before I start working on effects I wanted to see what was out there.
View 1 Replies
Jun 23, 2004
[URL]
-go to "collection"
-click on the image and see how the images are broken into long rectangles that then builds itself up to form the complete image.how is this done?where can i find the script if it is at all?
View 3 Replies
Apr 25, 2005
Well I'm creating a small image gallery of thumbnails and am looking for interesting effects when the big pic loads. I'm sick of just fading in images with the alpha setting and need some inspiration. I've done a google search but it revealed nothing of any use.
Do you know of any tutorials for this or fla downloads?
View 4 Replies
Feb 24, 2011
How do I change the CSS rules for a TextField that already has style associated with it ?
This TextField is inside a RichTextEditor.
Here's the code I'm trying:
_rSts: StyleSheet = new StyleSheet();
_rSts.parseCSS('font {font-family:Verdana; font-size:12;}');
_rTextField.styleSheet = _rSts;
but when I assign the new StyleSheet to the TextField it throws an exception stating that I cannot assign a style to an element already containing a style.
View 1 Replies
Jan 4, 2011
To situate things I am working on a translation utility with a datagrid having 3 columns : translation code, reference text and target text.
The DataGrid's dataProvider property is bound to an ArrayCollection instance. The user can edit the grid and on a successful edit, the underlying collection is updated using the setItemAt() method. The collection also has a filter function to make it easier to find certain texts.
When the user clicks the 'apply filter' button the filter function is updated. This works well. The problem I have is that rows are hidden as soon as the underlying collection item change in a way that doesn't comply with the filter. The row is hidden immediately, which is not very user friendly. Rows should only hide (or be shown) when the 'apply filter' button is pressed.
View 2 Replies
Mar 22, 2010
I am observing a problem with how an embedded font is applied to certain Flex components, namely mx:Label and mx:DataGrid. I have a CSS that declares three variations on an embedded font as follows:
@font-face
{
src:url("buttons.swf");
[Code].....
(I've snipped some stuff from both style rules, so if you think there's something that may be causing a conflict I can certainly post the entire definition. It's mostly color, line and padding stuff for the DataGrid.)
The problem that is for both Label and cells in the DataGrid the text is being rendered as sort of a times new roman font. The headers in the DataGrid are fine, just the text in the cells is wonky. All other components use the correct font as defined in the CSS/SWF.
View 1 Replies
Apr 24, 2011
My Dataprovider for a grid is an arrayCollection which is dynamically loaded with Objects . for example : a person object with persionID,PersonName ..etc . I applied a filter function on my dataprovider based on personID . below is my function
public function FilterFunc(item:Object):Boolean
{
var same:Boolean=String(item.personID ) == filterpersonID ;
return same;
[Code]....
this function is called whenever a new object is being added to the arraycollection . The problem now is dp.length in the above function is returning only the no of objects of the particular personID on which the filterFunction was applied instead of the absolute value . Its not limiting the size of the other objects which are runnning into thousand's causing memory issues . once i change the filterFunction to different personID , it slowly starts limiting the respective personID objects. So the sizeHandler() limits only the personID objects for which filterfunction was applied instead of the whole objects , this is the problem .
View 2 Replies
Oct 4, 2011
I'm testing some font embedding in Flex 4. Using the tutorial below (modified a bit), I'm loading in fonts via compiling CSS into SWFs. [URL] When I apply those styles to my Flex components all is well, however, I need to add an AS3 component to my Flex app. This component has some Flash text fields in it. The only way I know to embed fonts in AS3 is completely different and I believe requires another load. What I want to know is if there is any way that the text fields in my AS3 component can use the same styles and embedded fonts that the Flex components are using.
View 1 Replies
Dec 21, 2011
I'm having issues with implementing a flex button componentI have applied a CSS style to button and set border-color to, say #555555.So far, it works as expected.Then, when my application is resized, the border of the button component becomes blurred and its width automatically changes from 1 pixel to 2 pixels, which doesn't look very well.hen I maximize the app again, after the border is blurred, the buttons' border becomes 1 pixel and looks nice.
View 1 Replies
Jul 19, 2009
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)
View 6 Replies
Oct 27, 2009
how would the 3-tier architecture be applied in a Rich Internet Application?I thougt that flex was presentation, .net web services where busines and informix was data. But then when I started I feel that I must be wrong.
View 1 Replies
Feb 26, 2010
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);
View 1 Replies
Jul 17, 2010
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.
My "save code" goes as follows:
Code:
import JPGEncoder;
Security.loadPolicyFile("195.62.199.219/pctsla/gis/supporttool/crossdomain.xml"); //see note below
[Code].....
Note: PHP cannot be installed on the server I am working with for various reasons so I need to pursue other routes.
View 0 Replies
Nov 3, 2009
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.
View 1 Replies
Apr 6, 2009
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.
[Code]......
View 9 Replies
Nov 12, 2010
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.
View 6 Replies
Jan 12, 2010
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?
View 1 Replies
Feb 27, 2012
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?
View 4 Replies
Jun 28, 2010
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.
View 1 Replies
Jan 19, 2011
How can i save a webcam screenshot to a website?
I know you can save it to your hard drive using:
var browseFileReference = new FileReference();
browseFileReference.save(video);
But how would i go about it to save this image to a website, lets say flickr or facebook or something.
View 3 Replies