Loading, cropping and saving jpg files in Flex

I try to apply code selection, cropping and saving data of the image (.jpg, .png) as shown on the web site:


http://www.Adobe.com/devnet/flash/QuickStart/filereference_class_as3.html#articlecontentAd obe_numberedheader_1

The sample application is contained in a class called culture contained in the Crop.as action script file that begins as follows:

package
{
import com.adobe.images.JPGEncoder;
import com.adobe.images.PNGEncoder;

import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
to import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.net.FileFilter;
import flash.net.FileReference;
import flash.utils.ByteArray;

Culture/public class extends Sprite


My application is trying to use the cream class by including the Crop.as file:

< mx:Script source = "Crop.as" / >

in the Flex component that needs her and then calling the constructor of harvest to execute methods of the class

var localImage:Crop = new Crop();
localImage.Crop ();

My application does not compile. The package statement (or the brace on the next line) is marked with the error "packages cannot be nested.

I have no idea why it must be that I don't see any definition embedded anywhere in my application. The component includes the Crop.as file that contains the definition of package and class.

Can anyone give my some indication as to why this error occurs?

Any help would be greatly appreciated.

Hi Scott,.

#1

"utils" is my own namespace to "declaration of Application:

"" xmlns:utils = "*".

so it could be later directly in the mxml as code:

#2

Yes, generally all content referenced in the code must be imported. -If your code does not already contains--add:

Import mx.controls.Button;

at the top of your code.

to learn more about the subject:

http://help.Adobe.com/en_US/Flex/using/WS2db454920e96a9e51e63e3d11c0bf61c8a-7ff4.html

("Including against importation of ActionScript");

Kind regards

Peter

Tags: Flex

Similar Questions

  • Inconsistency of saturation according to the Treaty and saved the file.

    I have PSE12 and CS5.  When I adjust an image in two I can achieve a level of Nice saturation however when I view the image you saved my file to the computer, the saturation is very much exaggerated. That is what it is? What other version see if I enter a contest?

    OK, that's as I thought, a range wide screen.

    It is normal and just how to work these units. Applications without full color just not usable management and trust - they display saturated and there is nothing you can do. It's just the case that you agree implicitly when you buy a model from the range.

    Always use fully managed color requests if there is (like most Adobe applications). They will display correctly, as long as you have a valid monitor for these applications to use profile.

    It also means you need to calibrate and profile the unit with a stallion. If you use the generic Dell profile that installed from the CD that is not very reliable. As far as I know you can download the software of calibration of Dell, but you still need a screen i1 sensor to go with it.

    Working with a range of large screen is no problem at all, as long as you are aware of the implications and use accordingly.

  • Organizer freezes when importing all the mov and some jpg files

    I used the Task Manager to close Photoshop Elements 10 and then go out the jpg on that it froze the folder. Relaunch Photoshop, select some files and run until the frost.

    He has read thousands of jpg files, but just freezes on the other. I have no idea what's different about these jpg. Can't find any help by searching the forums. Since a few hours on this now.

    Any suggestion would be appreciated.

    I need to find a way for her to read mov files, because with all the travel, I managed to delete them from my network-attached storage which did not have the burning trash (he says disgustedly).

    Your original thought "except a few network problems" proved to lead me to a solution.

    Open and save the photo on which Photoshop has frozen in XnView or Lopesoft does not solve the problem, but Photoshop would hang on the last picture in a directory, so I do not think the problem, I noticed was due to bad data.

    I was reading the photos on my home network of a SIN. I transferred photos on a scsi drive connected to the pc (I think about 30 vs 4-Mbit/s). Photoshop imported about 6000 photos. The only difficulty was with a single photo and Photoshop gave me a message that it has been altered and could not be read. This allowed me to continue to import.

    Your suggestions of two software look like they may be very useful in the future. If you have any other suggestions for the software I'd appreciate hearing about them.

    You are the kind of knowledgeable and helpful person that I always hope to meet in the forums.

    Thanks again for your help.

    George

  • How to get an original RAW image after cropping and openness RAW file?

    Hello

    I have a Canon EOS 350 d camera and now PSE 9.  I have taken a few RAW images & imported in PSE 9 OK.  I know that the original RAW image is preserved after the change.  However, after cropping a picture BRUTE of the editor and then "Open" and "save under" a PSD or JPEG, I then close the image in the editor and the cropped image appears in the Organizer.  This is as it should be, I think.  If I then want to start from scratch on the original RAW image, it seems to me that I have to manually remove the modified version and the .xmp file in Windows Explorer, and then double-click the RAW file in Windows Explorer, which then open correctly in the editor of PES 9 of origin.  Is this possible to PSE 9?

    When you open the original camera raw image, go to the context menu

    and choose default Camera Raw, which resets everything except the crop, straighten,

    and rotatate parameters.

    To get rid of the culture and/or straighten the settings, click on and hold on to the crop tool and choose the option clear crop.

    To reset the settings of Image rotation, you have the back turn manually using the image rotation buttons.

    MTSTUNER

  • I just CS6 down loaded updates and saved my down load file, now what

    How can I get to intergate into programs like PS Flash CS6, etc

    To win:

    After downloading a ".zip" file, use the operating system or a utility such as WinZip or PKZIP to access the file content.

    Double-click the "AdobePatchInstaller" application and follow the instructions on the screen.

    For Mac:

    After downloading the "dmg" file, double-click the file to mount...

    Double-click the "AdobePatchInstaller" application and follow the instructions on the screen.

    Kind regards

    Ashutosh

  • Doesn't load bookmarks in saved profile file

    I have a new pc before I turned off my old pc, I saved my Mozilla profiles for a USB key file. I replaced the Mozilla profile on the new pc with the USB profile and none of my favorites are here. I can't believe I lost 7 years of bookmarks.

    You can not just replace the profile, the old profile name not be recognized in the new installation of Firefox. You must copy the content from the old profile to the new profile folder, replacing the files in there. and rename old profile to the folder folder new profile or change the profiles.ini file to change the name of the new profile to that of the name of the old profile.

  • How to print a list of the names of the pictures in a file (I have over 700 different names and separate .jpg files)

    I scanned and stored genealogical photos and documents in my laptop.  I have over 700 documents in format .jpg.  All are in a single file.  I would like to print a list of the names of the document and photograph, but not to print documents and images in their entirety.  How can I do this?

    Meg Staton,

    The leak-you don't need to use. However, I see that you have typed the "BOLD" section but you haven't typed the entire order? dir/a/b (space) c:\users\meg\pictures\ancestrydocs\ (space) > c:\users\meg\pictures\ancestrydocs\list.txt (space)

    I used (space) instead of a real space for clarification.

    The part of the order before > basically Gets the list of the names of files that are included in the ancestrydocs folder and the part of the order after the > creates a text file list.txt names in this directory with the names of the files.

    Awaiting your response

    Chris.H
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Problem downloading and saving a file text not in the SD card

    Hi all

    My goal is to download a KML file and save it to the SD card.

    My code did not throw any error and has also created a new file in the SD card. But the data inside is not correct.

    Someone please correct my mistake.

    Here is my code:

    public final class MyTest_ToDownloadAndSave extends {screen

    public MyTest_ToDownloadAndSave() throws IOException

    {

    StreamConnection conn = null;

    InputStream inputStream = null;

    FileConnection fConn = null;

    OutputStream outputStream = null;

    byte [] byteVal;

    StringBuffer sb = new StringBuffer();

    try {

    Conn is Connector.open (StreamConnection) ("https://sites.google.com/site/mykmltest1/multilockml/cta.kml", Connector.READ_WRITE);.

    inputStream = conn.openInputStream ();

    int ch;

    while ((ch = inputStream.read ())! = - 1).

    {

    SB. Append ((char) ch);

    }

    }catch(IOException e) {}

    throw new IOException ("problem with the URL");

    } {finally

    try {

    if (inputStream! = null ) {

    inputStream.close ();

    }

    if (conn! = null ) {

    Conn.Close ();

    }

    }catch(System.Exception e) {}

    throw new IOException ("close connections problem");

    }

    }

    "Rtx RichTextField = new RichTextField (downloaded successfully"+ sb.toString ());

    Add (RTX);

    try {

    fConn = (FileConnection)Connector.open("file:///SDCard/BlackBerry/cta2.kml",Connector.READ_WRITE);

    if (! fConn.exists ()) {

    fConn.create ();

    }

    outputStream = fConn.openOutputStream ();

    if (sb! =null & sb.toString ()! = "") {

    byteVal = new byte[sb.length ()];

    byteVal = sb.toString () .getBytes ();

    outputStream.write (byteVal);

    }

    RichTextField rtx1 is new RichTextField ("registered successfully");.

    Add (rtx1);

    }catch(IOException e) {}

    throw new IOException ("writing to SD card problem");

    } {finally

    try {

    if (outputStream! = null ) {

    outputStream.close ();

    }

    if (fConn! = null ) {

    fConn.close ();

    }

    }catch(System.Exception e) {}

    throw new IOException ("close connections problem");

    }

    }

    }

    }

     

    http://en.Wikipedia.org/wiki/List_of_HTTP_status_codes

    3xx is the guy you want

  • I "chose to open Firefox Setup 5.0.1.exe" and saved the file but nothing happens, my version has not been updated, I don't know what should be the next step and I would appreciate help with this question.

    I tried to do this several times over several days, on a HP a1620n running Windows XP Media Edition, Version 5.1. Nothing happens after that I get the full download message. Thank you.

    In its current edition, click on Tools, go to modules, then Extensions and remove "Ask Toolbar".

    Close and then restart Firefox and go to help | Look for the updates. The update should automatically start.

  • [Q] loading a JPG file externally in different MCs &amp; amp; Download

    Hi, I was wondering if I put a few MCs to load the same external JPG file, users will need to download theme several times?

    Or only need to download once?

    I have a problem loading long 700 * 8000 jpg files due to the pixel size of 2300 (?).

    I've been thking of making them in 2000 * 2000 square by photo images long cut short sigments and putting them side by side.

    and using as to make them appear as single image long using 2 MCs, with the same image but posted on different charge square photo x.

    Someone at - it better idea?

    I am a little hesitant to make the jpg to swf files cuz, I have too many pictures

    Please some free time for me...

    Thank you for your time ~!

    the limit is 2880. but you can work around the limitation by importing your jpg in a fla and publish the SWF. You can then load the swf "oversized".

    but, in general, you can download the jpg even repeatedly (and if you expect that the first is completely downloaded before launching other downloads) and the first is downloaded. others will be retrieved from the cache of the user.

    p.s. I do not know how to download the jpg even hope that you are dealing with the limitation of size of download of jpg.

  • I recently did a factory reset on my computer and saved all my files on a flash drive when I load them onto my computer, they look all as internet files explore instead of dreamweaver files, please, help?

    I recently did a factory reset on my computer and saved all my files on a flash drive when I load them onto my computer, they look all as internet files explore instead of dreamweaver files, please, help?

    They probably had the IE icon because Windows automatically associate with IE html files.

    It is of no consequence for your work in Dreamweaver, but you can change this association if you wish.

    Go to control panel > default of programs > set Associations.

  • Download the pdf or jpg file and save it on the device for consultation offline

    Hello

    Publication of an AIR for iOS app via Flash CS5.5, anyone know if it is possible to download a pdf or jpg file and save it on the device for consultation offline?

    If so, could you give me some advice on the relevant categories?

    Thank you

    Mark

    Save the content of the loader in byte array, and then send this byte array to FileStream

    Something like:

    mcLoader = new URLLoader();

    mcLoader.dataFormat = URLLoaderDataFormat.BINARY;

    var req:URLRequest = new URLRequest (file);

    mcLoader.addEventListener (Event.COMPLETE, contentLoaded);

    mcLoader.load (req);

    private void contentLoaded(e:Event):void {}

    var dataContent:ByteArray = new ByteArray();

    dataContent = e.target.data;

    var fileName:String = "mylocal.pdf".

    var f: File = File.applicationStorageDirectory.resolvePath (fileName);

    Save the file in the local space

    If (f.exists == false) {}

    trace ("file does not exist. Record file');

    var fs:FileStream = new FileStream();

    FS. Open (f, FileMode.WRITE)

    fs.writeBytes (dataContent);

    FS. Close();

    trace ('saved');

    }

    }

  • I have an email message Seasons Greetings and a jpg photo. How to crop and size the photo and attach it to the message?

    I have modified Seasons Greetings year last for 2011 and also scanned a photo 8 x 10 to create a .jpg file. How do I crop the image and attach the smaller peak resulting to e-mail?

    Just a question... you want to remove some
    some parts of the photo of cropping (IOW... zoom in)
    or do you simply want to reduce the file size of the
    Photo?

    FWIW... Windows Live Photo Gallery can crop
    and resize the photo to the e-mail:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Windows Live Photo Gallery 2011
    http://explore.live.com/Windows-Live-Photo-Gallery
    (There are other apps when you)
    install... uncheck those you don't want to)

  • When I load a .jpg file to 'My pictures' one '. the jpg.files folder is automatically created.

    This also happens if I copy the folder that contains the .jpg files in "my pictures". It does not occur if I load the .jpg files on a disc of external data storage.

    The PC is a Sony Vaio VGN-FW53GF, Windows 7 Home Edition has been pre-loaded when purchased from the merchant. I've upgraded to Windows 7 Professional immediately after purchase.

    If I delete the '. jpg.files' C drive - "My pictures", I noticed that the '. jpg.files' are re-created.

    I don't know any 'file settings' to stop this behavior.

    Hello

    1. this happens only with jpg files?
    2. you use "Vaio content analyzer" or something related to the "Photoshop CS / elements"?

    Check the following suggestions and.

    Method 1:
    Open Vaio content analyzer, go in settings and uncheck the three options.
    1 video analysis
    2 image analysis
    3. analysis of music

    Method 2: Run a full scan using the Microsoft Safety Scanner.

     

    Refer to this link:

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    I hope this helps.

  • 5 Lightroom sometimes fails to load EXIF GPS data from .jpg files

    Until I Lightroom, I used geoSetter to add GPS data to my .jpg files. Most of them have loaded up in LR without problem, but for some of them, Lightroom could not import the GPS data. I used to compare GPS data in the loaded files OK and those who have not noticed that some of the problem files do not have exiftool: GPS, GPS Time Stamp, dater GPS map data. I used exiftool to change these in the file, Lightroom still not managed to load GPS data.  Anyone has an idea why Lightroom 5 sometimes fails to load EXIF GPS data from .jpg file

    = P3207532.jpg - data from GPS not imported into Lightroom

    ID of the GPS Version 2.2.0.0

    GPS Latitude Ref North

    GPS Longitude Ref is

    REF Altitude GPS altitude

    Time GPS 2015:03:20 02:18:36Z

    GPS Latitude 20 deg 54' 41.68 '' N

    GPS Longitude 107 deg 0' 5.47 "E

    GPS Position 20 deg 54' 41.68 '' N, 107 deg 0' 5.47 "E

    = P3207533. JPG - Imported data GPS OK in Lightroom

    ID of the GPS Version 2.2.0.0

    GPS timestamp 02:22:26

    GPS map Datum WGS-84

    GPS Date Stamp 2015:03:20

    Time GPS 2015:03:20 02:22:26Z

    GPS Latitude 20 deg 54' 43,41 "N

    GPS Latitude Ref North

    GPS Longitude 107 deg 1 9.10 ' E

    GPS Longitude Ref is

    GPS Position 20 deg 54' 43,41 "N, 107 deg 1 9.10 ' E

    = P3207532.edited.jpg - data from GPS not imported into Lightroom

    ID of the GPS Version 2.2.0.0

    GPS Latitude Ref North

    GPS Longitude Ref is

    REF Altitude GPS altitude

    GPS timestamp 02:22:26

    GPS map Datum WGS-84

    GPS Date Stamp 2015:03:20

    Time GPS 2015:03:20 02:22:26Z

    GPS Latitude 20 deg 54' 41.68 '' N

    GPS Longitude 107 deg 0' 5.47 "E

    GPS Position 20 deg 54' 41.68 '' N, 107 deg 0' 5.47 "E

    The problem with P3207532.jpg is that it contains two sets of GPS, a values in the section of EXIF metadata in the XMP metadata section:

    $ exiftool -a -G P3207532.jpg | grep -i gps
    [EXIF]          GPS Version ID                  : 2.2.0.0
    [EXIF]          GPS Latitude Ref                : North
    [EXIF]          GPS Latitude                    : 20 deg 54' 41.68"
    [EXIF]          GPS Longitude Ref              : East
    [EXIF]          GPS Longitude                  : 107 deg 0' 5.47"
    [EXIF]          GPS Altitude Ref                : Above Sea Level
    [EXIF]          GPS Time Stamp                  : 02:22:26
    [EXIF]          GPS Map Datum                  : WGS-84
    [EXIF]          GPS Date Stamp                  : 2015:03:20
    [XMP]          GPS Date/Time                  : 2015:03:20 02:18:36Z
    [XMP]          GPS Version ID                  : 2.2.0.0
    

    But the XMP section contains an incomplete set GPS fields. Note that XMP:GPSDateTime specifies a time other than EXIF:GPSTimeStamp.

    I don't know which of your programs may have created these XMP values false, incomplete, but they confused LR.  According to the specifications of the Working Group of the metadata, which accepted LR, LR, choose the EXIF GPS values and false XMP values should not confuse it. But LR is preferring the XMP values and then conclude it is not all the GPS coordinates.

    You can work around this bug in LR by doing:

    ExifTool - xmp: gpsdatetime = - xmp: gpsversionid = file

Maybe you are looking for

  • Satellite U300 - 15 p: Multimedia issues

    Hello I would be grateful if someone could tell me if I can connect to this computer to a TV.If not, what is the best laptop, USB powered external speakers, I could use. Thank you very much

  • How can I use bluetooth on my Satellite C850-B906

    Please help me. How can I use bluetooth on my Satellite C850-B906. I can't find on the bottom of the search, and even in the PC device, bluetooth is not there. This laptop has bluetooth according to its specifications. (Bluetooth / WiFi (802.11B/G/N)

  • Qosmio X 70-B-10 t - internal error of power after updating the graphics driver

    Hello world Ive not long has this laptop and every time I install the AMD Catalyst software on it so I can use the AMD graphics card I get a BCOD telling me error of internal power followed continuous restarts with the same error before system restor

  • Elite 7500 MT series: Audio

    After you have reinstalled windows 10 I have I have no sound and I rceive message "Expensive voor geluidsweergave geinstalleerd Geen" (no audio installed) I can't find the driver and do not know the name of the audio app thank you for your help Ronni

  • Deleting files from the hard disk after you download on skydrive

    I need to free up space on my hard drive, I have a lot of photos and personal videos, if I moved to SkyDrive could - I safely delete them from my hard drive?