| home | about | time | appearance | space | other | tips & tricks |
Randomized TimeIn real life, part of the events we witness happen without our will and sometimes without us even anticipating them. In other words, we can't always tell when an action occurs, so in order to create realistic effects, we have to introduce this doubt in the movies. You may wonder when this becomes useful. Imagine the next effects: » someone mumbling Knowing how to trigger events in flash randomly means knowing how often the action occurs. So you need to establish three things: Let's start with: var ok, value, desiredValue:Number;
value = ...
desiredValue = ...
// the next sequence has to loop endless
// or until a condition is satisfied
ok = random(value);
if( ok == desiredValue ) {
// trigger action
}
After setting the Frame Rate think about the probability of the event to happen and decide on a "value": bigger number if you want it triggered rarely and smaller for an often occurrence. "desiredValue" is a number between zero and one less than "value". So the event happen whenever the randomly generated number ("ok") is equal to one of the numbers in the desired interval ("desiredValue"). You can use multiple values for "desiredValue" but instead, you can increase or decrease the "value" variable. Here are three examples of how you can play with these parameters, including two ways of creating the loops. |
| Copyright © 2007 Sorin Carp. All rights reserved. |
| FlashRandomEffects.WebArticles.Org is not affiliated with Adobe Systems Incorporated, USA. Adobe Flash is a registered trademark of Adobe Systems, Inc in the United States of America and/or other countries. The purpose of this website is to provide information for mastering Adobe Flash and creating Flash effects. |