Home arrow Flash arrow Flash MX Prototyping Basics
FLASH

Flash MX Prototyping Basics


Flash MX prototyping allows you to extend your movies in ways you never thought possible. By using prototyping you can share an effect or function among several movies without the need to replicate the code. This leads to your movies being more efficient, smaller in size and easier to code. Prototyping is not for the faint of heart so if you’re new to ActionScript or just programming in general you may want to brush up on the basics first. This article will provide the foundations to begin prototyping for yourself as well as provide some solutions to commonly asked questions in the forum.

Author Info:
By: David Millington
Rating: 4 stars4 stars4 stars4 stars4 stars / 10
June 09, 2004
TABLE OF CONTENTS:
  1. · Flash MX Prototyping Basics
  2. · A Side Note on Paths
  3. · Dealing with Time
  4. · Self Containment

print this article
SEARCH DEVARTICLES

Flash MX Prototyping Basics
(Page 1 of 4 )

Basics

The prototype property can be located in the ActionScript panel under Objects->Core->Function->Properties->prototype.

You can declare and delete prototypes anywhere in your movie.  A good idea is to write all of your source code in the first key frame of your movie.  If you're familiar with FlashComm, then you'll know that Macromedia recommends this. One very good reason to do this is so that later on when your project is complete, it can be fairly straightforward to move your code into an external .as file. This provides many benefits such as being able to share code among several movies and sites. The examples used here are written in the first key frame of _root.

A simple prototype is demonstrated below:

MovieClip.prototype.centerAlign = function(maxWidth, maxHeight) {
  this._x = (maxWidth/2)-(this._width/2);
  this._y = (maxHeight/2)-(this._height/2);
};
myMovie.centerAlign(780, 438);

The breakdown of the above is that all movie clips are given a new function called centerAlign. This new function will align a movie clip to the middle of two user defined variables. This can be used to center a clip on the stage or within another clip assuming the registration point is 0,0. To activate the new function simply requires you to call it as you would another other function. This prototype is used in this article's example to center align the child movie.


blog comments powered by Disqus
FLASH ARTICLES

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials