As3 :: Flash - Use To Load Binary Data From Web Server?
Oct 19, 2011
I'm trying to load some binary data from server like this
var urlRequest:URLRequest = new URLRequest("http://localhost/test.php");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
I originally tried to capture, encode and upload the audio using Silverlight, but because of the lack of suitable client-side encoding options, I'm now giving Flash a shot (Flash has baked-in support for encoding to Speex).I think I've figured out how to capture and encode the audio... But now what was easy in Silverlight, is the challenge in Flash.My server-side is .NET: MVC2-I'm open to receiving the audio in whatever manner is best- REST, WCF..So that's my question: How could one upload binary data from Flash, to a .NET server-side endpoint
I am working on the web base flash application I am trying to communicate with server through binary socket to the server IP Address and Port using Action script 3.0 at the server side we are using java. I will like to send binary data string to the server in a clubbed single packet.
I'm trying to send about 1 MB of binary data to server via URLLoader. But when I call method load of this class, my application hangs for about 1-1.5 seconds, then uploading runs normally. How can I prevent it?
1 - SWF must have ability to loading binary data from any domain.
2 - SWF cant load policy XML file from url, cause upload form allows me only to upload swf files, so I cant include any other data. I tried:
Security.allowDomain("*");
But it works only for SWF files.I tried to embed policy XML file:
var dataXML:XML = <?xml version="1.0"?> <!-- http://www.foo.com/crossdomain.xml --> <cross-domain-policy>
[code]....
This will make an security error, if file is from different domain than SWF file.Its possible to get binary data from JavaScript using ExternatInterface in AS3 code.Here is cross-browser library for reading files binary: binary reader and later version jDataView.
We have a system that allows a user to upload any image, which we store on the server. Of course, it is simple to load an image (that you know the path to) using loadMovie, but I also want to load certain pieces of meta data about the image that is precalculated and stored on the server; we may one day want to retrieve things completely unrelated to the image as well, so consider the non-image data to be arbitrary.So, that said, is there a way to simply return the image as a variable (urlencoded and returned in a loadVars request, perhaps) and then load that data into a movie clip?
Bonus Lightning Round Question: Is there a way to check the output of a PHP script which processes uploads when the request is sent via FileReference.upload(url:String)? Should I load/escape the binary data and then send it using a loadVars() request if I want to see the output?
im doing a level editor for my game and i need to save the tilemap data (120x120 uint array) and character data (character type, position, rotation, stats, etc) to a .bin file. How can i do it? I know i can do it by using XMLs but it is not good for saving tilemaps...
I am working on the web base flash application I am trying to communicate with server through binary socket to the server through IP Address and Port using Action script 3.0 at the server side we are using java. I will like to send binary data string to the server in a clubbed single packet. I dont know the Action Script 3.0 as much.for this We will have to communicate through IP and Port only
I am trying to have a PHP page load some variables into aFlash banner ad that will be running on 8 different websites...I need to have one central location for the PHP page andallow 8 other domains access this data...I am finding that when everything is on one server... noissues... data reads just fine...But when the PHP page is on one server and the SWF file onanother... the data never gets through...I am assuming this is some issue with security within
I have project Business card design, my app have feature save their design with PNG extension after customer design their business card to server. I sent binary of PNG to server by urlRequest and urlLoader. But with files have file size more than 5mb, it can't upload.
I have a custom socket class designed to connect to a server and talk with it. At one point, the server uses hex data for speed, however Flash seems to not get ANY of this data. In fact, it doesn't get ANY of the data from that point to the next packet.
I wrote an image editor for my cms and wanted to send the image respectively the through the BitmapData's getPixels()-method received ByteArray to a PHP-script that displays and finally saves the image. Obviously I didn't succeed. How do I have to encode my binary data so that PHP is able to read it and how do I have to treat the bytes in PHP? I also tried encoding the image data with the corelib classes from [URL] but it didn't work as well.
I'm trying to make a little ftp upload app - not a full FTP client, just something to enable image upload with decent performance. I basically took the approach Lee used in his POP3 socket tutorial. The problem I'm having is that I can connect to the FTP server and I can authenticate and log in but as soon as I try to enter passive mode for data transfer I get nothing- not even an error. From looking at the FTP RFCs, FTP requires two TCP connections - a command connection and a data connection - does this mean that I need to open a second socket for the data transfer? Another possible issue is the Flash Player security policy not allowing conection to ports under 1024 - I have not placed a policy file or policy server on the host running the FTP server but as I can successfully login, I appear to be able to connect to port 21 (standard FTP port) anyway. The code I'm using is:
Code: Select allvar s:Socket = new Socket("ftp.actechnology.co.uk",21); var ftp_response:String; s.addEventListener(ProgressEvent.SOCKET_DATA, receiveReply); s.addEventListener(IOErrorEvent.IO_ERROR, showError);
[Code].....
why passive mode kills it or has successfully connected to a FTP server with the socket class
I am using pixelfumes reflect class to create a releflection, the problem i have is (i) It only accepts reference to a movieclip. (ii) I cannot cast my binary data as a movieClip var item:Bitmap has to stay as a bitmap so either I make a copy of it as a moveclip and reflect it or find a way to pass it directly into the new Reflect() constructor.
So, as the title says I was wondering if it is possible to scale bytearray/binary data from lets say 640x480 which is being captured from the stage to 1024 x 768
Sometimes flash-socket ignors data which is being sent by server. I dunna know exactly if it's server-side problem(data actually aint being sent) or flash.How does flash handle numerous of data packages comming from server ? I know that flash perform all actions in single thread, but what happen when flash recive a lot of packages at same time ? Does flash serialize incomming packages and then call ProgressEvent.SOCKET_DATA for each package or just ignore those packages which cant be handled runtime ?
I'm missing a couple of bits somewhere. I'm trying to send and receive compressed binary data using AS and PHP, but I receive allways the error "Error #2058: There was an error decompressing the data". [code]...
I would need to save some binary data (bitmap data or similar) as a part of XML file.[code]...
I suppose I must serialize or encode "ba" (binary bytearray data) some way to string before writeing to XML and decode them back during the reading from XML, but I cannot find the correct way how to do it.
I am using pixelfumes reflect class to create a releflection, the problem i have is
(i) It only accepts reference to a movieclip.
(ii) I cannot cast my binary data as a movieClip
var item:Bitmap has to stay as a bitmap so either I make a copy of it as a moveclip and reflect it or find a way to pass it directly into the new Reflect() constructor.[code]
I am attempting to setup a binary socket connection between flash running on my desktop and a Rabbit RCM3800 Microcontroller providing the server on my home network, which has no file system and has a very basic http server on it. Due to limitations of the microC I cannot run Java/Perl/Python or any other server on it other than setting up a server using its own native Dynamic C language (essentially manually opening and controlling sockets in C). I am able to successfully connect to a socket on port 3333 of the server and transfer information between the server and the .swf file when it is the sandbox type "local-trusted" (while I'm debugging in Flash).
Because of this I'm fairly certain the code to setup the socket between the server and flash works fine. My problem occurs when I try to run the .swf file as "local-with-network" (such as running it after publishing on my desktop) or "remote" (accessing the .swf file when it is located on the server) and it then requires a socket policy server to host a socket policy file on the server. On my server I have code setup such that whenever a socket opens on port 843 or port 3333 (my data port) and sends a stream of raw data containing the request <policy-file-request/>, the server writes back in ASCII the below code and closes the socket.
So for some reason flash times out while waiting for the socket policy file. I have tested sending the <policy-request-file/> over telnet, and have received the above policy file. I have also sniffed using wireshark and saw that my desktop sent the policy request and received the policy file. I am guessing that Flash times out because it is waiting for some kind of terminating character that states the end of the policy file, and to that end I have tried sending. Interestingly, instead of sending the policy file I have tried sending random data from the server to flash, and flash displayed the Warning: Ignoring policy file at (URL) due to incorrect syntax. Because I don't receive this warning when I send my policy file I don't think it is formatted incorrectly.
I have also tried using the below flash code to hold the socket request open indefinitely, but it also errors after 20seconds. Code: Select allSecurity.loadPolicyFile("xmlsocket://192.168.1.59:843"); The .swf file will eventually reside on the server itself at 192.168.1.59/myProg.html. I have only tested the flash file remotely on the server a couple times, and in addition to the previous warnings/errors, I received the warning: SWF from (URL) may not connect to a socket in its own domain without a policy file.
But how can i do this in as3 ? I didn´t find a possibilty to encode "unsigned long (always 32 bit, little endian byte order)". Is there a option like unpack in as3 ?
I've got XML data in AS3 that needs to be compressed, validated on my Java Google App Engine servlet then saved to a file in Google Cloud Storage. Later that file will be opened and decompressed by the AS3 client. The process works if I do it with plain XML or text, but if I ByteArray#compress the data, it dies during ByteArray#uncompress with "There was an error decompressing the data".
I've tried setting the content type and mime type at various points, as well as encoding with Base64, but every attempt seems to break in a different way and I never get the same XML back that I sent in. Do I need to use multipart? Should I compress on the server? [code]...
i have a string which contains all binary data. the binary data represents a custom object in my application.
i want to convert all the data inside the string into binary format and store it in a ByteArray. then I want to read the object from the ByteArray using readObject.
I'm trying to write a flash program that will import JPEG's and embed them into an XML string for storage. However, i'm having some trouble with casting them back into Bitmap objects, after encoding and decoding the strings in Base64.
I've used the external Base64 encoding class created by Steve Webster, which seems to work great in encoding and decoding the files, but i'm clearly doing something wrong in my code. I'm not sure how exactly I should be converting the decoded bytecode back into an image object, and get flash to display it. Should it be a bitmapData? do I have to code it via setting the pixels manually? Or can I simply just cast it as a Bitmap object?
here's a snippet of my code to show what I mean - At the moment this will return an error. Other things i've tried seem to return the object as a memory reference, rather than it's actual data.
(trace statement) decoded.readObject() = ���� Error: Error #2030: End of file was encountered. at flash.utils::ByteArray/readObject()"