As Code 2.0: new language elements

Source: Internet
Author: User
Tags array event listener exception handling http request id3 new features sort flv file

Flash's ActionScript (as) code control is an important part of the flash to achieve interactivity, but also different from other animation software. This year's new Flash MX Professional 2004 Action scripting language has been upgraded to 2.0, an object-oriented scripting language that executes the ECMA-262 scripting language specification and supports inheritance, strongly typed, and event models. Use Action scripting language 2.0 to write more robust scripts.

The new features of Action scripting Language 2.0 include new language elements, improved editing and debugging tools, and the introduction of more object-oriented programming models.

This series of articles will give you a detailed description of the new features of as Code 2.0 and the changing relationship between the new security model and the Legacy SWF file.

  New and changing language elements

Flash MX Pro 2004 's Action scripting Language 2.0 adds some new language elements and makes useful improvements to existing language elements. (alphabetical order of the following)

Note: To use these elements, you must specify that the target player is a Flash 7 player when you publish the document.

  (1) Array.Sort () and Array.sorton () method
Lets you add parameters to specify additional sort options, such as sorting in ascending order and descending order, sorting case sensitivity, and so on.

  (2) Button.menu, Movieclip.menu and Textfield.menu properties
Work with the new ContextMenu and Contextmenuitem classes, allowing you to establish a link between the right-click shortcut menu option and the button, movie clip, or text box object.

  (3) ContextMenu class and Contextmenuitem class
Allows you to customize the right button shortcut menu.

  (4) Error class and throw with try. Catch.. Finally command
Allows you to implement more robust exception handling.

  (5) Loadvars.addrequestheader () and Xml.addrequestheader () method
You can add and modify HTTP headers (such as Content-type or soapaction) that are sent using the Post method.

  (6) Mmexecute () function
Enables you to publish Flash JavaScript API commands from action scripts.

  (7) Mouse.onmousewheel Event
(Windows only) generates a Mouse.onmousewheel event listener when the user uses the mouse wheel.

(8) movieclip.getnexthighestdepth () method
Allows you to create movie clip instances at run time and ensure that their objects are rendered in front of other objects in the z-axis space of the parent movie clip. The Movieclip.getinstanceatdepth () method allows you to use depth as a search index to access dynamically created movie clip instances.

  (9) Movieclip.getswfversion () method
Allows you to determine which version of the Flash Player is supported by the loaded SWF file.

  (a) Movieclip.gettextsnapshot () method and Textsnapshot object
Allows you to handle the text of a static text box in a movie clip.

  (one) Movieclip._lockroot property
Allows you to designate a movie clip as the root movie clip (_root) of any movie clip inside it, or to keep its _root property unchanged when a _root movie clip is loaded into another movie clip.

  (a) Moviecliploader class
Allows you to monitor the progress of loading files into movie clips.

  (Netconnection class and NetStream Class)
Allows you to stream a local video file (FLV file).

  (a) PrintJob class
Lets you (and the user) have more printing control ability in the Flash player.

  (Sound.onid3 event handler function)
Allows you to access the ID3 data in the sound (voice) object that contains the MP3 file.

  (SOUND.ID3) Property
Allows you to access metadata as part of the MP3 file.

  (a) System class
Has new objects and methods, and the System.capabilities object has several new properties.

  (Textfield.condensewhite) Property
Allows you to delete extra spaces in the HTML text box rendered in the browser.

  (textfield.mousewheelenabled) Property
Allows you to specify whether the contents of the text box should scroll when the mouse pointer is in a text box and the user scrolls the mouse wheel.

  (a) Textfield.stylesheet class
Allows you to create style sheet objects that contain text formatting rules such as font size, color, and other formatting styles.

  (Textfield.stylesheet) Property
Allows you to assign a style sheet object to a text box.

  () Textformat.gettextextent () method
Receives a new parameter, and the object it returns contains a new member.

 () Xml.addrequestheader () method
Allows you to add or change HTTP request headers (such as Content-type or soapaction) sent using the Post method.

  New security model and legacy SWF file

The Flash Player has previously had rules that determine whether two domains are the same, which has changed in Flash 7 players. In addition, rules that determine whether SWF files from an HTTP domain are accessible, how to access SWF files from HTTPS domains, and the data that is loaded from the HTTPS domain have changed. In most cases, these changes have little effect unless the user exports the SWF file specifically for the Flash 7 player.

However, if you publish a SWF file for Flash 6 players or earlier players, the file loads the data from the file stored in the server, and if the file is played in the Flash 7 player, the user may see a dialog box that has not been seen before, asking if access is allowed. We can prevent the display of this dialog box by executing a policy file in the site where the data is stored.

If you are using a run-time shared library, you may also need to execute a policy file. If the loaded or loaded SWF file is published for the Flash 7 player and the two are not from the exact same domain, the policy file is used to set the license access.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.