View Full Version : New property
fizzzzzzzzzzzy@yahoo.com
08-22-2006, 01:59 AM
how can i call different objects based on the value of a certain property?
For example, if i wanted to do something to all the objects left or below a certain point but not through names because the objects in that area would change.
Colin Campbell
08-27-2006, 03:24 PM
Well basically you would attach a code to each movieclip that checked to see if it was in a certain position, and if it was, execute whatever code you wanted to
leftbutton_mc.onRelease = function() {
// checks to see if mc1 is left of a value (200)
if (mc1._x < 200) {
// change its alpha to 50, you can do whatever in here
mc1._alpha = 50;
}
// or, if you wanted to check to see whether it was left of another object:
if (mc1._x < mainmc._x) {
trace("mc1 is left of the main movieclip");
mc1._alpha = 50;
}
};
If the movieclip's X property is lesser than (or <) another movieclip's, then it is left. If the movieclip's X property is greater than (or >) another movieclip's, then it is right.
This is just some simple math used to check values against each other. The IF statement is your friend :)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.