Website Designers and Webmasters

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

ActionScript – this


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 ActionScript/Flash Tutorial is like all of my tutorials, quick and to the point. I hope I don’t type too fast for you. 😉

Using “this” in Flash/ActionScript

The “this” command/function is an extremely useful one. It makes it easy to use relative paths (as opposed to absolute).

Here is what the Adobe Dictionary says about “this”:

Description
Keyword; references an object or movie clip instance. When a script executes, this references the movie clip instance that contains the script. When a method is called, this contains a reference to the object that contains the called method.

Inside an on event handler action attached to a button, this refers to the Timeline that contains the button. Inside an onClipEvent event handler action attached to a movie clip, this refers to the Timeline of the movie clip itself.

To put that into English:

If you have a movie clip, and your “on (press)” statement is:

//On Press, the button will disappear.
on (press){
this._visible = 0
}

This will work no matter how many levels deep into the movie you move this movie clip. “This” calls the path to that movie clip. So if your movie clip is named “mcbutton”, and it’s placed on the root of your movie:

on (press){
trace(this);
}
// Returns: “_level0.mcbutton”

That is a very useful piece of ActionScript to know, as you will end up using that in every movie you make.

_level0.is basically the same thing as _root. A more extensive definition will come soon.

Another Note about “this”

If the above example was done with a button instead of a movie clip, the trace(); would return “_level0”

-“Flash is by far my favorite computer program.”
-Ashton Sanders

Tags: , , , , ,

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment