"I initially saw several websites doing something I wanted to do, but not exactly what it is now," he said. I want to do some of the network applications are first to use flash, but my employees are not familiar with the flash, I would like to use the traditional Web technology can also achieve the effect of flash. I later discovered in practice that JavaScript and XML are two traditional web technologies that can be implemented. ”
The above text is the Ajax author of Jesse James Garrett in the "internet+ Internet century Forum," when he received an interview with Sina, said. What do you think of this text, do you feel that flash has something in common with Ajax? Two days ago wrote an article called "Asp+ajax to create no refreshing news review System," the article through an example to explain the general description of the use of Ajax, today, I would like to use the same server-side code, and then see how the implementation in Flash.
Flash software version: Flash 8
Operating system: Chinese Windows operating system
First, flash knowledge points
1, Usecodepage
A Boolean value that notifies Flash Player whether to use Unicode to interpret an external text file or to interpret an external text file using a traditional code page of the operating system that is running the player. The default value is False.
Because the external files invoked in this article are GB2312, not Unicode, you must system.usecodepage=true, of course, if you want to make sure that you are working properly on all platforms, it is recommended that you use Unicode for external files.
2, Attachmovie (Movieclip.attachmovie method)
Public Attachmovie (id:string, name:string, Depth:number, [Initobject:object]): MovieClip
Parameters:
Id:string-The link name of the movie clip symbol in the library to attach to a movie clip on the stage. This is the name you entered in the Identifier field in the Link Properties dialog box. Link properties pops up by right-clicking the component "link" in the library.
Name:string-The unique name of the movie clip instance attached to the movie clip.
Depth:number-An integer that specifies the depth level of the location where the SWF file is placed.
Initobject:object [optional]-(supported by Flash Player 6 and later) contains objects that you want to use to populate the properties of the newly attached movie clip. This parameter enables a dynamically created movie clip to receive clip parameters. If Initobject is not an object, it is ignored. All properties of Initobject are copied to the new instance. The properties specified with Initobject are available for constructors.
Returns MovieClip-a reference to a newly created instance.
Example: Attaches a link identifier to a pllist component to the main scene.
_root.attachmovie ("Pllist", "Pllist", 1);
3, the movie clip Dynamic Path representation method
Because most of the movie clips in the program are dynamically loaded, the number and location of the movie clips are not predetermined, which requires us to set up the movie clip while the program is running. In general, the name of a dynamically loaded movie clip will follow the same rule: MC1, MC2, MC3, mc4 ... how do we represent these dynamic movie clips?
[] Array access operators
The array access operator enables you to dynamically set and retrieve the names of instances, variables, and objects. It also gives you access to object properties.
Example: _root["MC" +i]
Eval function
Access a variable, property, object, or movie clip by name. If the expression is a variable or property, the value of the variable or property is returned. If an expression is an object or a movie clip, returns a reference to the object or movie clip. Returns undefined if the element enumerated in an expression cannot be found.
Example: eval ("_ROOT.MC" +i)