Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

Animating Dynamic MovieClips - Page 7
       by kirupa  |  30 August 2006

In this page we will continue the code explanation from the previous page. The end for these explanations is almost near though, so stay patient.


inputMC._xscale += 10;
inputMC._yscale += 10;

In the above lines, I am increasing inputMC’s x and y scaling. Because I want the scaling to be uniform, I am incrementing both the _xscale and _yscale properties by the same value, 10.


inputMC._alpha -= 1;

Like the two lines above it, this time, I am decreasing our inputMC movie clip’s alpha property by 1. While decreasing by one might not seem like a lot, remember that this line and the above two lines are executed 25 times a second!


if (inputMC._alpha<0) {
inputMC.removeMovieClip();
delete inputMC.onEnterFrame;
}

This if statement becomes true if the alpha property of our movie clip drops below zero. In another way of phrasing this, the if statement is true when our input movie clip becomes invisible.


inputMC.removeMovieClip();

In this line, I invoke the removeMovieClip() method to remove the inputMC movie clip from the stage. The reason I do this is that there is no need to waste memory storing a movie clip that is invisible and no longer useful.


delete inputMC.onEnterFrame;

This line marks the final step towards ensuring our newly removed inputMC movie clip is not taking up system resources. I am deleting the onEnterFrame event handler that had so faithfully ensured that inputMC scaled proportionately while fading out at the same time.

Notice that I am using the delete keyword on inputMC.onEnterFrame. I am specifically deleting only this instance of the onEnterFrame event handler tethered to the inputMC movie clip. It is important to not arbitrarily delete the wrong onEnterFrame event handler.

Now that you have a good idea of what the code does, in the next page, I will provide an overview of how the various pieces of the program work together.

Onwards to the next page!

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components

Flash Templates
CSS Templates
Dreamweaver Templates

flash menus, buttons and components
Digicrafts Components The best flash components ever!
Entheos Flash Website Templates Buy and sell FLAs at Ultrashock!
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components  Learn how to advertise on kirupa.com