Categories
Featured jobs
» More ActionScript, Flash and Flex jobs.
» Advertise a job for free
Our network
Advertisement

 »  Home  »  Tutorials  »  Flash  »  Beginner  »  Set Property

Set Property

By Jesse Stratford | Published 09/9/2005 | Beginner | Rating:
Jesse Stratford
Jesse lives and works in Melbourne Australia. He is the Cofounder and a Director of http://ActionScript.org. A Flash enthusiast, teacher, author, freelancer and speaker Jesse enjoys participating in the http://ActionScript.org community and the wider Flash scene when he has time. 

View all articles by Jesse Stratford
Page 1 of 2
Written by: Jesse Stratford
Difficulty Level: Beginner
Requirements: Flash 4 or higher
Topics Covered: How to use the Set Property action in Flash.
Assumed Knowledge: Instances, Paths

Download the source file for the above movie here. (Zipped, PC, Flash 5 file).

(Those of you who have read the Get Property tutorial might experience a bit of Deja Vu here as I have duplicated many paragraphs since they are relative to Set Property also).

The Set Property function, like its sister Get Property, is vital for any would-be Actionscript user, no matter their level. Mastering this function will broaden your spectrum for interactivity in no time flat!

Let's get going! Let me start by saying the code examples given here are for Flash 5 (and above) but if you can't convert them into Flash 4 code yourself you need help! The only real difference is that Flash 5 (and above) uses 'setProperty' and Flash 4 uses 'Set Property'. *Shock!*

Also note that because this is a beginner level tutorial I am going to start by using the actual setProperty command. We'll get into infix notation later.

All objects in space have attributes or properties: such as width, height, position, color, etc. Flash is no different, all visual elements within your flash movie have properties. Often it is beneficial to us if we can set the values of such properties, and Actionscript allows for this beautifully.

Take the movie clip above as an example. We want to poke and prod Cheesey (my mouse's instance name). Using Set Property we can make him fat/skinny, transparent, upside-down (rotated), invisible and more! Now Cheesey is under our complete control. *Evil laugh*.

Usage of Set Property takes the following basic form:

setProperty ( target, property, value);

Where target is the instance name of the object within the Flash movie which we are interested in examining, property indicates the property we wish to set and value is the value we wish to set it to. The target is generally the path to a movie clip (see the paths tutorial for more on paths). The value is almost always a number, in expression form, not a String. I say again, not a string - don't use quotes around numbers! See the variables tutorial if you don't quite understand the difference.

We'll go into more depth over the page...


Spread The Word / Bookmark this content

Clesto Digg it! Reddit Furl del.icio.us Spurl Yahoo!


Search Entire Site
Add to Google
Advertisements
Article Options
Latest New Articles
Set up a simple IIS Server for Flash
by Peter McBride

Day 1 at FITC Toronto 2008
by Anthony Pace

Simple reflection effect with AS2
by Jean André Mas

ActionScript.org Meets Josh Tynjala (aka dr_zeus)
by ActionScript.org Staff

Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
by Sabrina F

mailing list
Enter your email address:
mailing list
Subscribe Unsubscribe
© 2000-2007 actionscript.org! All Rights Reserved.
Read our Privacy Statement and Terms of Use...
Our dedicated server is hosted and managed by WebScorpion Webhosting.