| Ultrashock Tutorials > Flash MX > Flash MX Quicktips for Developers | ||||
|
||||
| Flash MX Quicktips for Developers | ||||
|
You can now find out which function called the current function, by checking the arguments.caller property. By contrast, the arguments.callee property gives you the currently executing function. You can set a breakpoint in your code, which allows you to step through it line by line and debug. The debugger is much improved over Flash 5. It shows you the currently executing call stack and local variables within functions. Button symbols are now instances of the Button class. They are quite similar to movie clips now. You can give a button an instance name with the Property Inspector, and manipulate its properties with ActionScript. Movie clips can now behave like buttons. The following event handlers can be assigned to a movie clip:
See this tutorial for more details. None of the Flash 4 commands that were deprecated in Flash 5 have been removed in MX. Also, no Flash 5 commands have been deprecated in MX.
Any movie clip can become a mask for any other movie clip: mc.setMask (maskMC); You can no longer do left-side assignment with eval. For example, this will no longer work: eval ("name" + i) = "zyblor"; This is intended behavior--Macromedia brought eval() closer to the ECMA-262 specification. To accomplish the dynamic assignment, use the set() command: set ("name" + i, "zyblor"); Event handlers can be assigned directly to objects as properties. Previously, movie clip events could only be accessed with onClipEvent. Now you can handle them with these event handlers:
You can also use button events with movie clips. See this tutorial for more details. The Array, String, and XML classes are now written in C++ instead of ActionScript. As a result, performance is greatly improved. XML parsing is often 20x faster. Use the class methods as much as possible (instead of older substring(), etc.) to take advantage of the speed increase. The LoadVars class is much the same as the XML class. The difference is that you use a LoadVars object to load in variables from a URL. It even has getBytesLoaded() and getBytesTotal() methods so you can use a preloader on your data.
A useful JavaScript command is now available in ActionScript. Make a function execute at a regular interval, specified in milliseconds: function tick() { trace (getTimer()); } MX allows you to create graphics with ActionScript. The API (Application Programming Interface) has eight MovieClip methods:
The Sound class has several new properties and methods:
Use the Stage Object to find out the height and width of the movie stage at run-time. You can also set alignment properties and have the stage notify other objects when it is resized. The switch statement is finally available in ActionScript, just like in JavaScript. It's even backwards compatible to Flash 4! Here's an example: switch (rank) { Text fields are now instances of the Textfield class. They have also become similar to movie clips. You can give a text field an instance name. Any text property you can set in the Property Inspector, you can manipulate with ActionScript.
The XML class is now written in C++ instead of ActionScript, resulting in much better performance, often 20x faster. The XML class has two new methods: getBytesLoaded() and getBytesTotal(). These allow you to use a preloader on your XML data.
|
||||
|
©2000 Ultrashock.com
Inc. - All rights reserved
|
|