I’m using this lines of codes to access a php file and to determine where to save my image
loadingsign.visible=false var scriptURL="http://test.mysite.com/flash/saveIMG/"; //absolute path to directory containing savePNG.php on your server var savePath="testIMAGE"; // save filename excluding .png file extension (relative path from scriptURL) var scriptName="savePNG.php"
It works god when I’m in flash but it won’t work when I upload it to a server, I have come to understand that it has something to do with flash sandbox security problems but I have no idea how to fix it, I have tried to write a relative path like ” saveIMG/ ” (if the flash would be in the flash folder)
Someone that has any idea how to fix it??
and here is the code as wholeimport com.adobe.images.JPGEncoder;
import nl.stroep.utils.*;
import com.gskinner.utils.SWFBridgeAS3;
//SETUP::::::::::::::::
loadingsign.visible=false
var scriptURL="http://test.mysite.com/flash/saveIMG/"; //absolute path to directory containing savePNG.php on your server
var savePath="testIMAGE"; // save filename excluding .png file extension (relative path from scriptURL)
var scriptName="savePNG.php"
///////////////////////
/*
//WHEN THE CONNECTION IS ESTABLISHED: (optional)
myBridge.addEventListener(Event.CONNECT, handleConnect);
function handleConnect(event:Event){
//setupSWF is an example how to call an AS2 custom function:
myBridge.send("setupSWF","parameter1");
};
*/
//PRINT BUTTON ACTION:
goBTN.addEventListener(MouseEvent.MOUSE_UP, goBTNclick);
function goBTNclick(event:Event){
loadingsign.visible=true
goPrint(22,22,702,500)
}
//CREATE AND EXPORT THE JPGS TO PHP:
function goPrint(X:Number,Y:Number,W:Number,H:Number){
var thecrop = crop( stage,W,H,X,Y);
var imageSaver:ImageSaver = new ImageSaver( scriptURL+scriptName );
imageSaver.save ( thecrop, savePath );
imageSaver.addEventListener ( Event.COMPLETE,onSaveComplete)
imageSaver.addEventListener ( IOErrorEvent.IO_ERROR, onSaveError );
trace('PRINTING: '+X+', '+Y+', '+W+', '+H+" to:\n"+scriptURL+savePath+'.png');
}
function onSaveComplete(e){
trace('SAVE COMPLETE')
loadingsign.visible=false
}
function onSaveError(e){
trace('ERROR WITH SAVE')
loadingsign.visible=false
}
/////////////////////
//FUNCTIONS::::::::::
function crop( inDisplayObject:DisplayObject, inWidth:Number = 550, inHeight:Number = 400, inX:Number = 0, inY:Number = 0, inScale:Number = 1):Bitmap{
if (!inDisplayObject) { throw new Error('CropUtil.crop > needs a something on the display list'); return null; }
var cropArea:Rectangle = new Rectangle( 0, 0, inWidth * inScale, inHeight * inScale);
var croppedBitmap:Bitmap = new Bitmap( new BitmapData( inWidth * inScale, inHeight * inScale), PixelSnapping.ALWAYS, true );
croppedBitmap.bitmapData.draw( inDisplayObject, new Matrix(inScale, 0, 0, inScale, -inX, -inY), null, null, cropArea, true );
return croppedBitmap;
}
stop();- Attended a Community Meetup
- Bought between 10 and 49 items
- Contributed a Blog Post
- Contributed a Tutorial to a Tuts+ Site
- Envato Staff
- Exclusive Author
- Gold Mo Grower
- Has been a member for 4-5 years
- Referred between 1 and 9 users
Look up info on crossdomain.xml. That should help solve your issue. 
LOL I never managed to get that AS2 bridge with AS3 working.
I always ended up coding a solution in AS3 , yeah but anyway this sounds like very much like a crossdomain.xml problem.
Any issues, or further information required post back here…
