Results 1 to 5 of 5
-
July 22nd, 2009, 05:32 AM #154Registered User
postsUsing 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);
bmd.draw(stage);
import com.adobe.images.JPGEncoder;
var jpgEncoder:JPGEncoder=new JPGEncoder(85);
var jpgStream:ByteArray=jpgEncoder.encode(bmd);
fr.save(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!
-
July 22nd, 2009, 08:39 AM #2
-
July 22nd, 2009, 10:18 AM #354Registered User
postsOk 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
-
July 22nd, 2009, 10:25 AM #4
-
July 22nd, 2009, 10:32 AM #554Registered User
postsoh s**t..... i am so sorry... got it working.... it is an awesome method.... no server trips as well

Reply With Quote



Bookmarks