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
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Full Schedule
g
g Flash and Animation Site

BellaOnline's Flash and Animation Editor

g

Flash ActionScript and Data Types


Some programming languages are more strict than others when it comes to following syntax and coding rules. For example, the HTML scripting language is somewhat forgiving when it comes to programming errors. You can have errors in your source code and your web page will still be viewable in the web browser. However, if you have worked with FlashR and ActionScript at all, you know that it is far less forgiving. Therefore, we need to be far more careful when writing our ActionScript code.

One of the coding rules that you will encounter many times when writing your ActionScript code is the use of data types. One place where you will need to use data types is when declaring a new variable. In a previous tutorial, you learned the code to create a new variable.

var name_of_variable = value;
var container = 20;

In the above code from the previous tutorial, we have not declared a data type for our new variable. We need to do that. Let's add the data type to the above code now.

var container:Number = 20;

As you can see, we first add a colon to the end of the name we have given to the variable. We decided to name the variable "container". So the colon is placed at the end and the data type is added to the right of the colon. In the example, the value of the variable is 20 and 20 is a number. Therefore, we need to declare the Number data type.

There are two other data types, which are the String and Boolean.

If we had set the initial value of our container variable to the word "David", then the data type would have been set to String because "David" is a text string of letters. We would also have needed to place quotation marks around the text string. String data is the only type of data that requires you to enclose the data between quotation marks.

The third data type is Boolean. You would use the Boolean data type whenever the value of the variable is true or false. One good example of this is a conditional statement. We could write a conditional statement that tests if a value is greater than 10. If the value is 11, the Boolean will be true. Otherwise, it will be false.




Add Flash+ActionScript+and+Data+Types to Twitter Add Flash+ActionScript+and+Data+Types to Facebook Add Flash+ActionScript+and+Data+Types to MySpace Add Flash+ActionScript+and+Data+Types to Del.icio.us Digg Flash+ActionScript+and+Data+Types Add Flash+ActionScript+and+Data+Types to Yahoo My Web Add Flash+ActionScript+and+Data+Types to Google Bookmarks Add Flash+ActionScript+and+Data+Types to Stumbleupon Add Flash+ActionScript+and+Data+Types 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
Animating Color of Text in Motion 5

Animating Color of Shapes in Motion 5

Motion Workspace - Checkbox, Dials and More

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