So here's the deal,
I'm trying to save variables from flash to PHP, however when i try to do so the php script seems to not acknowledge that i'm logged in.
This would mean that the session doesn't arrive in flash. How do i fix this?
AS3 added:
var bi开发者_运维技巧tmap:BitmapData = new BitmapData(loaded_swf.width, loaded_swf.height - 273, false, 0x000000);
var saveSelfyRequest:URLRequest = new URLRequest('urlhere.php');
saveSelfyRequest.contentType = "application/octet-stream";
saveSelfyRequest.method = URLRequestMethod.POST;
var bytes:ByteArray = PNGEncoder.encode(bitmap);
requestLoader = new URLLoader();
saveSelfyRequest.data = bytes;
requestLoader.load(saveSelfyRequest);
requestLoader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
I don't know Flash or ActionScript, but once I had a similar problem while developing a Java Applet which interacts with a php application which requires login. The problem was the fact that the applet make independent requests to the web app and not through the browser, so it was not passing a proper session id to the php app.
I solved this problem by passing a session_id parameter to the applet (using a param tag) and then making post requests to the app by setting a cookie with the value PHPSESSID=xxxxx
in the HttpClient used for the request.
Maybe you can try the same inside ActionScript.
To get confirms on my theory you can print all received headers in the php application to see if the cookie header is sent in the request.
精彩评论