logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA


dailyclick
All times in EST

Full Schedule
g
g Flash and Animation Site

BellaOnline's Flash and Animation Editor

g

eCard Project - Flash Script Assist Stop Action


In this tutorial, we will continue to build upon our FlashR CS4 eCard project. At this point, we have the animation completed for the eCard but this animation loops continuously. This is nice but it would be better if we could give the viewer the option to play the animation with a button.

Our goal for the next few tutorials is to add the ActionScript that will control when the movie plays. We will use a simple stop() code to stop the playback after the animation runs once. Then we will build a button that will allow the viewer to replay the eCard again. Open your working file into Flash CS4.

1. We want to stop the playback on the last frame of the animation. We will add the stop() code on Frame 75. But, first we need to add a new layer to the Timeline. Add a new layer above the Snow layer and name this new layer "Actions". Lock all other layers.

2. Right-click on Frame 75 of the Actions layer and add a Keyframe. We will "attach" our stop() action to this keyframe. Open the Actions panel (Window Actions). We will use Script Assist to quickly add our stop() code. Click on the Script Assist button to open the top pane. On the left of the Actions panel, you will see a menu of codes. Choose the following code.

flash.display MovieClip Methods stop

Flash will automatically give you the following code.

import flash.display.MovieClip;
not_set_yet.stop();

3. The "not_set_yet" before the stop() code tells us that we need to declare what we want to stop. We need to tell Flash to stop the main timeline, which we can identify with the "this" keyword. At the top of the Actions panel, type "this" into the Object field. Flash will automatically change the code to "this.stop()". You will also notice that Flash has placed a small "a" in Frame 75 on the Actions layer. This indicates that the ActionScript code has been "attached" to this keyframe.

import flash.display.MovieClip;
this.stop();

4. Test your eCard and it will only play once through the animation. When the playback stops, the snowfall will stop, the "Let It Snow" message will be in its final position and all three of the colored lights will be visible.

Now, we are ready to make a replay button to allow the viewer to replay the animation.



Join us in the Flash forum.




Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Twitter Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Facebook Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to MySpace Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Del.icio.us Digg eCard+Project+%2D+Flash+Script+Assist+Stop+Action Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Yahoo My Web Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Google Bookmarks Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Stumbleupon Add eCard+Project+%2D+Flash+Script+Assist+Stop+Action to Reddit



 



RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the Flash and Animation Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.

g


g features
Particle System - Emitter Shape Parameters

Motion Particle Systems - Introduction

Particle Fog in Motion 5 - Scene Graphics

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor