How to interact with object in Action Script 3
Hi all,
I am flash developer and use Action Script 3 for URLLoader and URLRequest to replace the previous version of the LoadVars method. But i am confused over the present system does not help improve the situation that Flash9 does not help, I need to know that how to interact with object in Action Script 3. Please suggest. Thanks in advance.
How to interact with object in Action Script 3
URLLoader is used to read the file from the network or local, you can set the attribute to change his dataFormat received text type.and AS 2 LoadVars is different is that he was the default value URLLoaderDataFormat.TEXT the plain text format, so the time to read outside the text variables have been changed a bit. The data Format for URL Loader Data Format variable. You can also use URLRequest. It is used to pass variables to the server, as well as URLLoader to load the target path. You can set the contentType attribute his change of variables sent to the server type, the default is application coding, which is URL Encode coding. Check and reply.
How to interact with object in Action Script 3
You can also use some object listed below:
URLVariables:Is used to configure the variable passed to the server key / value collections, such as user1 = JOHN & user2 = Albert.
URLLoaderDataFormat:URLLoader to read the file used to set the type, there is TEXT (plain text), VARIABLES (URLEncoding key / value collection), BINARY (2 binary format), URLLoader based on the type of the corresponding decoding operations such as decoding URL Encode. Best of luck.
How to interact with object in Action Script 3
At the same time there are other less frequently used object are:
URLRequestMethod:- Decide which way to pass data to the server, POST or GET.
URLReqeustHeader:- Is used to configure passed to the HTTP server header.It is worth mentioning that, URLLoader quite a comprehensive event to get us to read the data state, the following is a list of the URLLoader events.
complete:Use URLLoader.load () method, data is fully loaded when the trigger is usually triggered by this event if we can, then state your program is no problem.
How to interact with object in Action Script 3
You can also use some object in Action Script 3.
httpStatus : So With URLLoader.load () method to get triggered when the HTTP status code, by judging the state of his property we can get a remote file loading status. Success (200), Do not have permission (403), can not find the file (404), an internal server error (500) and others. Compelete prior to this event is always triggered.
ioError:Use URLLoader.load () method, to trigger a fatal error, I have not come across ..
open:Use URLLoader.load () method to start downloading data from the server when the trigger once, at this time URLLoader.bytesLoaded must be 0.
How to interact with object in Action Script 3
With regard to the recommendations of registered listener flashplayer built-in class all the events are related to the event class constants to represent, it is recommended to use them to register the event listener and all of the built-in class event class (Event) all in flash.events package, such as the use of:
Code:
importflash.events.Event;
Code:
urlLoaderInstance.addEventListener (Event.COMPLETE, completeHandler);
Instead
urlLoaderInstance.addEventListener ( "complete", completeHandler);
Check and reply.