Skip to main content
July 16, 2007
Question

flash as3.0 screen shot with php

  • July 16, 2007
  • 37 replies
  • 4382 views
hello, i'm so close to actually getting this to work and i'm breaking down and asking for some help. here is my actionscript and php codes, why doesn't this work?

the link for a preview and the error:
Link here

This topic has been closed for replies.

37 replies

July 27, 2007
You think just like me actually, or programmers in general I guess.

I do have CF set-up correctly been using it for a few years. Most recently on my new system it has already created folders, uploaded and downloaded correctly. So I'm 100% the permissions and everything if fine between CF and Vista.

The next step is the return of the string with CF and AS 3.0. This is my first attempt at remoting with CF and AS 3.0. I'm some what of an expert at 2.0 and remoting. I was able to get the string to return just fine with 3.0. However the binary array sends a parameter to the CF where as the simple return string does not. So there could be a problem there. I'm going to set-up a simple database and try to get flash to query it with a parameter. This way I will know if I'm for sure doing the AS 3.0 remoting correctly. I'm 90% sure it's right now.

I do have all these files in the zip I set-up for you. The only thing different in the zip is that the RemotingService.as document has the objectEncoding set to AMF3.

Really the only two things left that can be wrong are incorrect parameter passing of the binary array/creating the array, or incorrect CF script.

I'm using the CFC currently. I can also try to use the CFM, I found code for that as well.

I'll get to some more testing this weekend to at least make sure I'm remoting correclty with AS 3.0.

Thanks for all your help, again.
Inspiring
July 27, 2007
I know very little about the server side stuff... what I succeed in doing is normally throught a process of elimination and a combination of intuition/reference materials and sheer luck! But I am learning.

Does Vista have a system where services run under different account settings (e.g. Admin vs other user types). And does CF have the right permissions. If it has the same as IIS/PHP I guess it should be OK ... yes. Chances are its fine. I don't know much about this stuff, its just something I would be inclined to check.

OK... next -What I'd aim to do first is to verify that the CF remoting is set up and running properly - so eliminate that as any potential cause of the problem. I set it up a few years back for something I did, but can't remember how. In amfphp there's a gateway page that lets you know its working. There's a service browser too which lets you do tests on your methods/functions. (Although I can't see how you would do that easily with a byteArray argument! - at least not easily). I can't remember exactly how it works in CF, but I imagine there should be something similar. So if you can do any of that with CF, do it quickly to check all is well (if you haven't already)

If you've already done that, then get your test class to call the test connection function in your CFC and have it just return a simple Hello world string - there must be some examples for how to do this. If you can get that working then I think what you said at the very beginning of this thread (I'm soooo close) is even more true now ;-).

Then we can check the text saving and then the binary saving.

Apologies if I'm suggesting things here that you've already done... I can't be sure if you have or not.
July 27, 2007
I don't think it's the Vista, becasue the PHP "write" worked fine. I use the CF all the time for local "write" and no problems.

Is there a way to check and make sure my sending variable, the binary data is correct?

I've got to have this close.
July 26, 2007
Actually the coldfusion has never worked yet. I can only get the PHP to work.
Inspiring
July 26, 2007
Hmmmm.

"The WSsave doesn't yeild any errors but doesn't work"

But WSsave worked before the change, right? And there were no other changes made apart from the fresh CF install?

Is there some account type you need CF to run under in order to have file write permissions or are there directory level restrictions? I know nothing of Vista or Vista-64 or how that works.

July 26, 2007
After 5 hours I finally got CF updated. Seems that Vista-64 doesn't like you updating CF, or unistalling after an attempted update. Had to go into the registry to remove all of it and get a fresh install of CF 7.0.2.

Then I added the objectEncoding to my Flash services and set it to AMF3.

The WSsave doesn't yeild any errors but doesn't work. The ROsave still gives an error.

Any ideas???? I think we are soooo close...
Inspiring
July 26, 2007
OK, I took a look.

If you successfully got testJpegSave.ImageSave.ROsave to work using the same actionscript for the string/text data test then there are only (in my mind) two things left to check if the binary save is not working.

1. You're sending a byteArray as opposed to a string when you call the remote function with the jpeg data. This requires that CF remoting support is set up for amf3 because the original remoting amf version (I think its called amf1?) doesn't handle some of the new data types in as3 like byteArray. So two things here... check that CF has the remoting update installed... and if there are any settings to switch modes (if that's necessary - I think it is in amfphp) ...i.e. I'm not sure if you need to configure amf3 vs amf1 mode as a CF setting...
Anyhow more info here - check this is available with you CF setup:
http://kb.adobe.com/selfservice/viewContent.do?externalId=4ac796d0&sliceId=2

2. The other part is the file saving. But as near as I can tell from the CF livedocs (and another example I saw for saving binary data for a jpeg) the way you have
WSsave set up in you CFC looks OK to me.

My guess is its number 1 above.
-GWD
Inspiring
July 25, 2007
I'll take a look at the CF docs tomorrow. I'm no expert, but my impression is that reference in Dreamweaver is better than ASP.

And if nothing else I know there are references to doing exactly what you want with remoting in CF because I found them earlier today on a search (the example was exactly the same class - JPEGencoder bitmap upload coded using flex I think) . So there's always that approach - 'tried and trusted' instead of just trying to get the raw POST data (i.e. let remoting do that part for you).

Don't give up just yet.
GWD






July 26, 2007
Well I think I've gotten real close with the Coldfusion writing. First I had to figure out the remoting which I did for reading a string from a CF document. I'm not sure if I'm sending the binary data to CF correctly.

I've zipped up the files for you that I've used for the entire CF version of the save jpeg. They are at

Zip Files Here

Let me know what you think. I found the CF component online from someone else. I'm not sure if it's right.

Thanks again for all your help!
July 25, 2007
Still getting this error:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://localhost/Test/create.asp?name=snapshot.jpg
at finalSave_fla::MainTimeline/finalSave_fla::frame1()
July 25, 2007
This is my coldfusion. I can't seem to get any help in the CF Forum...

July 25, 2007
I actually just tried it and didn't work.

I really appreciate you still trying. I've been working for days! I still can't get this going.

Crap...