Flash
  Home arrow Flash arrow Flash MX Prototyping Basics
IBM developerWorks
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FLASH

Flash MX Prototyping Basics
By: David Millington
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2004-06-09

    Table of Contents:
  • Flash MX Prototyping Basics
  • A Side Note on Paths
  • Dealing with Time
  • Self Containment

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Flash MX Prototyping Basics


    (Page 1 of 4 )

    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.

    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.

    More Flash Articles
    More By David Millinton


     

    FLASH ARTICLES

    - Using XML and ActionScript with Flex Applica...
    - Interfaces and Events with ActionScript and ...
    - Manipulating Data with ActionScript in Flex ...
    - ActionScript Syntax for Flex Applications
    - ActionScript in Flex Applications
    - A Closer Look at Apollo`s File System API
    - Using the File System API
    - ActionScript 101
    - Flash Buttons
    - Advanced Flash Animation
    - Creating Your First Animated Movie with Flas...
    - Flash: Building Blocks
    - Building Preloaders
    - Fun Things to Do with Movie Clips in Flash MX
    - Referencing Movie Clips in Flash MX







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway