Program | Programmers have more than enough Designer,flash 5 to do animation, MTV, Web design, and Developer,flash MX for developing RIA is very poor in collaborative work, source files, and code management. The programming features of the upcoming Flash MX 2004 are a great breakthrough, refreshing feeling that developer can even drop tool bar drawing tools and timeline. Let's just look at the new features of Flash MX 2004 from a programmatic perspective.
One, Flash Player 7 In terms of performance, Flash Player 7 has significant improvements in action Script execution, video playback, and general image display, based on Macromedia Web page data. This is definitely good news for people who want to use flash for more complex programming applications.
In addition to bug fixes and operational efficiencies, Flash Player 7 has many more things that users can control. For example, a browse user can click a connection through a right-click menu to open a new window. (Flash Player 7 now has a new option: open, open in a new window, and copy the connection.) )
In addition, to help users keep up with the latest version of the patches, Flash Player 7 includes an automatic Update feature that the player detects a new version and instructs the user to update it every once in a while, which means that users will be very easy to upgrade the player to get the latest version of efficiency and security improvements.
Second, Action Script 2.0 In the new version, the programming panel and programming features of the Action script are greatly altered.
A. Programming Panel To improve programming efficiency and ease of use, the Action script's programming panel has been improved in a number of ways, listing only some of the more obvious features.
1. Automatic text matching when programming: In the Script Panel, debugger Panel, output panel, enter a keyword part, there will be a pop-up window, display matching words.
2. Associated Help information: When the cursor is moved to the keyword of the action script, a related Help topic is displayed on the menu, which is useful for people who are not very skilled in action script.
3. Import Scripts: When the import Script feature is selected on the Action Panel pop-up menu, the imported scripts is inserted into the appropriate location. Previous versions of Flash will overwrite the original script after importing scripts.
4. Breakpoint settings: Click on the left side of the panel to set a breakpoint. The so-called breakpoint is when debugging the program, run to the location of the breakpoint will stop, which is useful for monitoring the variables in the running of the program.
5. The Action panel no longer distinguishes between "normal mode" and "Expert Mode": In a new version, you can only enter commands directly in the script panel.
6. Display multiple scripts in the action panel: this has a very useful function, no need to jump to jump, thus greatly improve the development efficiency.
B. Programming features Action script has been in development, each flash new version of the release, will add new keywords, objects, methods, elements and so on. But unlike previous Flash versions, Flash MX 2004 implements a more standard object-oriented programming approach, where changes are so great that a new action script version appears: Action Script 2.
If Action Script 1.0 is JavaScript, that 2.0 is Java, rigorous data Type, complete class Based, very similar java! The appearance of Action Script 2.0 does not mean that the old Action Script 1.0 is eliminated because Action Script 2 is only a more rigorous programming language for developers, easy to develop, convenient for compile-time debug, and so on. Flash, written with Action Script 2.0, can also be supported for Flash Player 6 because 1.0 and 2.0 are compiled into the same class of Byte-code. 2.0 in addition to programming syntax, concepts, it must be written in the *.as external file, only the professional version of support. Traditional programmers might prefer to use Action Script 2.0. Now let's look at the programming features of Action Script 2.
1. Strict data types
You define a variable before you use it. A variable's type mismatch can easily lead to many errors, and strict data types can prevent the wrong type of value from being assigned to a variable. One advantage of strict data types is that when the action panel displays programming hints for variables, such as methods, values, and so on.
2. New language elements
With a lot of new language elements added to Flash MX 2004, it's important to note that new language elements are used in programming and must be available in Flash Player 7.
Button.menu, Movieclip.menu and Textfield.menu.
These properties are based on the ContextMenu class and are used when adding new menu options to an object.
ContextMenu and Contextmenuitem
These two classes can customize the display of ContextMenu when you right-click Flash Player.
Error, Throw and Try. Catch.. Finally
Through these exciting things, you can deal with exceptions more effectively.
Loadvars.addrequestheader () and Xml.addrequestheader ()
These two methods can add or change HTTP POST request headers (like the Content-type and SOAP Action).
Mmexecute ()
This function can refer to the Flash JavaScript API in action script, for example, click an HTML connection in the text field to throw a function in the action script.
Mouse.onmousewheel
You don't have to say that, do you? It is triggered when you scroll the mouse wheel.
Movieclip.getnexthighestdepth ()
This function returns the maximum depth of a movie clip.
Movieclip.getswfversion ()
This method can determine which version of Flash Player is supported by the published SWF file.
Movieclip._lockroot
This property allows you to specify a movie clip as a _root so that you can reference this clip in other clip, or you can lock a _root clip is not changed by load to other clip.
SOUND.ONID3 and SOUND.ID3
The SOUND.ONID3 event provides a way to manipulate the ID3 data that contains MP3 files. The Sound.id3 property can access the metadata of the MP3 file.
Textfield.condensewhite
This property can remove extra spaces from the text field.
Textfield.stylesheet
This class allows you to create a style sheet object that can come from a CSS 1.0 document or add it through the action script.
System and System.capabilities
The System has new objects and methods, and several new attributes are also in the System.capabilities object.
3. New Keywords
All the standard keywords in action Script 1 are supported in Action Script 2. In Action Script 2 you can program in a more object-oriented way.
The following keywords are added in action Script 2.
Class
Extends
Implements
Interface
Dynamic
Static
Public
Private
Get
Set
Import
C. ActionScript 2 Programming Example It is not possible to fully explain action Script 2 here. Action Script 2 Fully complies with the specification of the fourth edition of ECMA 262 ( http://www.mozilla.org/js/language/es4/) 。 Let's take a look at several programming examples of Action Script 2.
Class
This is a simple example of how to use classes in a flash MX2004.
class declaration:
Class Tpoint
{
Class Properties:
var _x:number = 0;
var _y:number = 0;
Class Contructor
function Tpoint () {
}
}
This is a slightly more complicated example.
class declaration:
Class Tpoint
{
Class Properties:
var _x:number = 0;
var _y:number = 0;
Class Contructor
function Tpoint (X:number, Y:number)
{
if (Arguments.length > 0)
{
_x = x;
_y = y;
}
}
function to overwrite properties with new values
function SetPoint (X:number, Y:number)
{
_x = x;
_y = y;
}
}
The following is the call to the class that you just defined.
var point0:tpoint = new Tpoint ();
var point1:tpoint = new Tpoint (5,5); Default values
Extends
This is a simple example of inheritance.
Class Tpoint3d extends Tpoint
{
var _z:number = 0;
function Tpoint3d (x, y, Z:number)
{
if (Arguments.length > 0)
{
Super (x, y);
_z = Z;
}
}
}
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.