AS3 help
- Started
- Last post
- 6 Responses
- Boz
I'm freakin' puzzled.. still transferring to AS3 but I have a very weird problem.
I'm trying to write a PNG file to server. So I got the thing coded out but the thing only works in Flash IDE. I upload it to the server and it stops working.
Here's the code:
// Mouse CLICK event handler
function generateCoverImage(event:Event... {// create a bitmap data object
var amazonBitmap:BitmapData=new BitmapData(312,373,true,0);
// draw a movie clip into bitmapData object
amazonBitmap.draw(amazonholder,n...// Using PNGencoder to encode bitmap data to PNG bytes
var PNGbytes:ByteArray=PNGEncoder.en...
randomNum=Math.random()*1000;
// set up the new URLRequest object for write
var writerequest:URLRequest = new URLRequest();
// define URLRequest sub parameters
writerequest.url="byte-reciever...
writerequest.method=URLRequestMe...
writerequest.contentType="image...
writerequest.data=PNGbytes;// create a new URLLoader object to send data
var amazonLoader:URLLoader = new URLLoader();
amazonLoader.load(writerequest);
amazonLoader.addEventListener( Event.COMPLETE, handleComplete );
}So what's puzzling is that this code works just fine from Flash IDE (considering I use the HTTP path to my php file).
When I upload to the server, the app won't execture php write.
What's even more puzzling is that when I take out the bitmapData creation and PNGencoder to bytes conversion and run the app on the server it works!.. So it's bitmapData that's causing a stall with sending to php file.
Does anyone have an idea why this is happening?
Thanks.
- akoni0
crossdomain.xml issue?
- Boz0
Crap, these threads should have the ability to post a code snippets without being cut.
- Boz0
there's no crossdomain.xml issue cause it's on the same server.. I mean the PHP file and my flash app.
- instrmntl0
use this http://pastie.org/
- Boz0
Here is the pastie code..
This is driving me freakin' nuts... This code works FINE in Flash IDE.. not working ok in the browser.. it stalls at bitmapData draw event and won't process anything after it.
Any help appreciated.. I have everything working in Flash IDE but when I moved to server stuff stopped worked and I was so looking forward to launching this small app and now I'm stuck. :(
- jpea0
First grab the UploadPostHelper class here:
http://marstonstudio.com/2007/10…
then try this (i didn't test it, but i think it'll work):
http://pastie.org/610939