For 2 days I've been trying to figure out why my code to export a jpeg from a movieclip in Flash CS3/AS3 won't work.
I have one movieclip on my stage on frame 1
My code works perfectly if I reference a movieclip INSIDE the movie clip on my main timeline but when I try the main timeline movieclip, nothing happens.
Got to be a bug in my code somewhere... but where??
Below is the relevant code: the movieclip on my main timeline is 'mainmovie'.
If I change the code to reference a movieclip within it ie: mainmovie.headers_mc for example, it exports out the jpg of the headers_mc fine.
If it helps: all I'm trying to accomplish is a screenshot of the stage for a user to download. After much searching all I could find were ways to reference a movieclip and export it as a jpg. Thats why I moved all the content into a single movie clip on the main timeline.
var serverPath:String = "";
function createJPG(m:MovieClip, q:Number, fileName:String)
var jpgSource:BitmapData = new BitmapData (m.width, m.height);
var jpgEncoder:JPGEncoder = new JPGEncoder(q);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest ( serverPath+"jpg_encoder_download.php?name=" + fileName + ".jpg");
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
var jpgURLLoader:URLLoader = new URLLoader();
createJPG(mainmovie, 90, "vehicle");