A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Actionscripting/Basic

Categories Basic Actionscripting
Author: Brandon Roe | Website: http://www.gentlepaws.com |

 
Page 5
«prev 1 2 3 4 5

Tying it Together

Still in the movie clip timeline, create a blank keyframe on the first frame of the actions layer. Open the Frame Properties dialog box and click on the Actions tab. Enter in the following code:

Set Variable: "numblink" = /:numblink
Set Variable: "x"="1"

The first line of this code simply creates a link from the textbox that we named "numblink" in the main movie timeline to the variable named "numblink" that is local(only available) to the movie clip. If you have used the Tell Target action in you flash development, you will know that the "/" in the first line references the main timeline, while the ":" indicates that the information being retrieved is a variable (in this case "numblink" - the name of the textbox). The second line creates the variable named "x" and sets the value to one. (This variable x will be used as a counter in the comparison that will be carried out later in the clip.

Now that we have initialized the variables, we need to compare them in order to determine how many times the clip will run. (Each run through of the clip will create one blink). Go back to the clip timeline and create a blank keyframe at frame number two. Again enter the frame properties box and click the actions tab. Enter the following code:

If (x <= numblink)
 Set Variable: "x" = x+1
 Else
 Stop
End If

I mentioned earlier that the "x" variable would be used as a counter. The first line simply compares our counter against whatever number the user entered. The second line indicates what happens if the above statement returns true. In this case, "x" will be increased by one so that when loop iterates again, the value of "x" will be one digit greater. This ensures that the loop has a finite ending. Therefore, when the value of x equals "numblink", the stop action is invoked and the blinking is halted.

Lastly, we need to set up the loop so that the "If" statement can iterate until the terms for stopping have been reached. This is achieved through a "Go to and Play" action situated on the last frame on the Action layer. Just remember to specify that the place to start is frame two (which we labeled "start"). This is because if we were to let the clip play frameone again, the variables would be re-initialized and the loop would never end.

Lastly, we have to set the button to call the blinker movie clip when it is clicked. This is done by assigning an instance name of "blink" to movie clip and adding the following code to the instance of the button.

On (Release)
 Begin Tell Target("/blink")
 Go To and Play(1)
 End Tell Target
End On

That's about it. I hope this has provided you with an interesting exposure to some simple actionscripting. Best of luck and happy flashing!!


«prev 1 2 3 4 5

» Level Basic

Added: : 2000-05-09
Rating: 5.28 Votes: 280
Hits: 21382
» Author
No information about the author has been provided
» Download
Download the files used in this tutorial.
Download (34 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs