|
Special notice! While MC Tween is a nice extension and it will continue to work for AS1 and AS2 until the end of time, it is my duty to inform all citizens that I have switched the focus from further development on MC Tween to a new AS2 and AS3 extension, a real Class this time, called "caurina.transitions.Tweener" (or just Tweener). Tweener doesn't have as many features as MC Tween yet (for example, it doesn't have native filter tweens), and the documentation isn't 100% done, but it features a complete, more solid redesign with a few additional syntax features that were impossible to achieve with MC Tween. And it works the same for AS2 (including Flash Lite 2+) and AS3.
So, if you use MC Tween, or you're thinking about using it, I'd like to suggest you try Tweener instead. It follows all the principles of simplicity I tried to feature on MC Tween, but with a more powerful syntax. Tweener download, examples and documentation are available on Tweener's page. You can read more about this change on this blog post.
Thank you for your attention and sorry for this ugly box. And don't worry, this website will not be deleted or anything.
Notice for October 2008: also note that, if you are still interested in MC Tween and don't want to use class-based AS2 or AS3 solutions, Larry Benedict has taken the matter into his hands and updated MC Tween with some filter features that are not available in the latest version. You can read more about it (and download his version) here or here.
Using MC Tween
To use MC Tween on your Flash movies, simply download and install it. After installing, you'll be able to use MC Tween's new methods and functions on a per-movie basis.
How to use MC Tween on a movie
To have access to all "extended" methods that MC Tween has, you just need to #include the extension file on the Flash movies you want to use the new tweening functions. To do that, first run Flash MX (or above) and create a new Flash document. Then, place this code on your movie's frame actions (preferably on the first frame):
#include "mc_tween2.as"
After doing that, all MC Tween commands will be understood by your Flash movie. Refer to the documentation to learn which new commands are available from that on. If you're using AS2, also read the AS2 usage notes.
One important thing to remember regarding external .AS files is that these files are #included on your movie during compilation, not during execution. This means that, after properly compiling your SWF movie, you do not need the .AS files online; you don't have to have them files along with your SWF files on the server or anything like that. That's because the .AS code is included on the SWF file itself, on the same position you used the #include line, as if it had never been an external file. Also, because of this, the MC Tween .AS file obviously adds size to the final SWF movie: currently, it adds around 7.9kb to the frame it has been added.
Installing MC Tween also adds syntax highlighting and code completion support for its new methods and functions on Flash.
Code completion and syntax highlighting
One of the most helpful features of working with actionscript on the Flash IDE is syntax highlighting and code completion. Instead of having to remember all object type's commands and their syntax by memory, the user can rely on the editor capabilities to list all methods and functions available to a specific object type and to highlight correct typed keywords. Fortunatelly, both these features are extensible, so when installing MC Tween, code completion and syntax highlighting for the new functions is also added: Flash will add MC Tween's methods to the list of methods possible, it will use a different color on correctly-typed methods, and it will display the syntax of MC Tween-specific commands when needed.
Code completion (screenshot) works by listing which methods and functions are available for a certain object, depending on its type. In this example (left), right after typing the name of a movieclip object and a period, the list of available methods and functions pops up. All MC Tween functions are listed and selectable.
Notice that, for this feature to work on Flash MX, it needs correct object suffixes, and that's why this objects ends with a "_mc" name (more information about that here).
Syntax highlighting (screenshot) is what makes Flash MX (and above) correctly paint your methods with a different color. That way, you know you didn't make a mistake when typing a function or method name. All MC Tween methods are also added to Flash's syntax highlighting keywords.
Be aware, though, that Flash uses syntax highlighting no matter if the method will work or not. This means that, even on movies that doesn't have mc_tween2.as included, MC Tween's methods will still get painted with a different color.
Code hinting (screenshot) is another powerful feature available on Flash. This means that, after typing a method or function name and opening parenthesis, the syntax for that particular function will popup, so you won't have to remember all function parameters and their order. This is specially good for MC Tween's methods since they can use so many parameters.
Item selecting (screenshot) is the final feature that the syntax file adds to Flash. By using the "Add Item" button on the actionscript panel to add new code to a Flash movie, you will find all MC Tween's methods and functions listed along with their corresponding object types, so you have a quick reference to what's available. Selecting one of the items on the menu inserts it on the code area.
Remember: just because you're getting syntax highlighting, code completion and other features inside your movie, it doesn't mean that MC Tween methods will work on that specific movie; you will have to use the #include line (mentioned above) for the new functions to be really available to Flash.