Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 5 of 5

Thread: Using the new save() in the file reference class

  1. #1

    Using the new save() in the file reference class

    For a project I am working on, I allow users to drag stuff around the stage and then let them save it as JPEG. I have used the new save method from player 10. This is my code so far.

    var fr:FileReference;

    test_btn.addEventListener(MouseEvent.CLICK, showPic);

    function showPic(event:MouseEvent):void {

    var bmd:BitmapData=new BitmapData(970,570);
    import com.adobe.images.JPGEncoder;

    var jpgEncoder:JPGEncoder=new JPGEncoder(85);
    var jpgStream:ByteArray=jpgEncoder.encode(bmd);



    But when I click on the button, I get the following erro

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at homev1_fla::MainTimeline/showPic()

    What am I doing wrong, please help!

  2. #2
    you never instantiated fr

  3. #3
    Ok this might sound a little stupid, but how do I do that? How do I instantiate fr? Sorry, i'm a bit of a newbie

  4. #4
    var fr:FileReference = new FileReference();

  5. #5
    oh s**t..... i am so sorry... got it working.... it is an awesome method.... no server trips as well

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012