Website Designers and Webmasters

Dedicated to all the tasks Webmasters, Website Developers and Website Designers find themselves facing.

ActionScript Basics – Variables


Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 116

Warning: Use of undefined constant add_to_content - assumed 'add_to_content' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 117

Warning: Use of undefined constant add_to_page - assumed 'add_to_page' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 118

Warning: Use of undefined constant add_to_feed - assumed 'add_to_feed' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 119

Warning: Use of undefined constant limit - assumed 'limit' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 120

Warning: Use of undefined constant match_content - assumed 'match_content' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 121

Warning: Use of undefined constant exclude_pages - assumed 'exclude_pages' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 122

Warning: Use of undefined constant blank_output - assumed 'blank_output' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 123

Warning: Use of undefined constant exclude_categories - assumed 'exclude_categories' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 124

Warning: Use of undefined constant exclude_cat_slugs - assumed 'exclude_cat_slugs' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 125

Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 116

Warning: Use of undefined constant add_to_content - assumed 'add_to_content' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 117

Warning: Use of undefined constant add_to_page - assumed 'add_to_page' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 118

Warning: Use of undefined constant add_to_feed - assumed 'add_to_feed' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 119

Warning: Use of undefined constant limit - assumed 'limit' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 120

Warning: Use of undefined constant match_content - assumed 'match_content' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 121

Warning: Use of undefined constant exclude_pages - assumed 'exclude_pages' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 122

Warning: Use of undefined constant blank_output - assumed 'blank_output' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 123

Warning: Use of undefined constant exclude_categories - assumed 'exclude_categories' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 124

Warning: Use of undefined constant exclude_cat_slugs - assumed 'exclude_cat_slugs' (this will throw an Error in a future version of PHP) in /homepages/29/d199346440/htdocs/awiaf/websitedesign/wp-content/plugins/contextual-related-posts/contextual-related-posts.php on line 125

This post is about variables in AcrionScript (the programming language for Macromedia/Adobe Flash).

ActionScript Basics

Some very quick basics

// <- These two slashes are a comment.
// Everything after a comment on that line
// will not be processed by Flash

every.statement.ends.with.a.semicolon;

Varbiable Basics

What is a variable? A variable is group of numbers and letters or one letter that will store an amount, a string or a true/false statement. A variable cannot start with a number.

// This Creates the variable “x” and
// gives it the numeric value of 4
x = 4;

// trace() will display whatever you put
// between the “(” and “)”.
trace(x);

// That will display: 4

In this example, the numeric value of “4” was stored in the variable “x”. Here is another example:

number = “4”;

trace(number);
// 4

These last two examples were very similar, but notice that the variable (number) was given the value of “4” (with quotes around it). The quotes changed the value of the variable from a numeric value to a string. A string is just a group of number, letters, symbols, etc. defined with quotes.

statement = “Here’s a statement for you”;

trace(statement);
// Here’s a statement for you

As I mentioned above, you can give a variable a numeric, string or true/false value. This third value type is called a Boolean value. A boolean value is either yes/no, true/false, 1/0, on/off, etc. In Action Script, you can assign them with either true/false or 1/0.

go = true;

trace(go);
// true

That is a quick summary of how to declare variables the shorthand way in ActionScript. My next posts will be along these same lines, so if you are hungry for more, check out my other ActionScript Posts them out.

If you have any questions, or if I was unclear at any part, feel free to leave a comment, and I’ll get it fixed up for you.

-Until Then,
-Ashton Sanders

Tags: , , , , ,

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment