Var Speed

Start & Stopping an ActionScript 2.0 Flash Script?
Started using a ‘rain’ effect in Adobe Flash CS3 on an Actionscript 2.0 project.
I have the script running as I want it to, with the effect working 100%.
But I only want the script to run at certain times, is there anyway of starting and stopping the script at certian frames with a function?
This is the script (However it wont work unless you have an imagine or movie for it to make ‘rain’ with);
var rain_speed:Number = 5;
var rain_density:Number = 60;
for (i=0; i<=rain_density; i++) {
_root.attachMovie("rain_id","rain"+i,_root.getNextHighestDepth(),{_x:Math.random()*Stage.width, _y:Math.random()*Stage.height});
}
makeRain = function () {
for (i=0; i<=rain_density; i++) {
_root["rain"+i]._y += rain_speed;
if (_root["rain"+i]._y>Stage.height) {
_root["rain"+i]._y = 0;
}
}
};
setInterval(makeRain,10);
Ok, Im not an expert in this but I am learning, but could you just use an IF and LOOP statement, with a new number field, so if you want this to run for 10 seconds you a bit of code that says
time = 10 <-- Meaning 10 seconds
then the IF and LOOP statement
which would say if time is not equal to 0 then run the code and also take 1 from time, so that it now equals 9, then it reads the code again and see it still isnt 0 so keeps running code and takes another 1 from time which means it is now 8
Eventually it gets to 0 and then you can have an if that says if it is 0 then stop
im not sure if this will work because im not great with ActionScript, but I do know many other computer languages and all of them have the IF and LOOP statement available for things like this
Hope it helps
|
|
NOS MOPAR 1968-72 A BODY VAR SPEED WIPER SWITCH KNOB DART CUDA DUSTER SWINGER £28.47 |
|
|
Speed Y Peeler Potato Vegetable Peeler Var Colours NEW £1.50 |
|
|
Speed Y Peeler Potato Vegetable Peeler Var Colours NEW £1.50 |
|
|
Speed Y Peeler Potato Vegetable Peeler Var Colours NEW £1.50 |
|
|
Speed Y Peeler Potato Vegetable Peeler Var Colours NEW £1.50 |
|
|
NOS MOPAR 1967 PLYMOUTH DODGE C VAR SPEED WIPER SWITCH £41.12 |
|
|
EINHELL BLUE ROUTER 1/4″ROUTER VAR SPEED 240V 1200W EINHELL BLUE ROUTER 240V £44.99 |
|
|
Sander Polisher 1200 Watt Var Speed – Left & Right Hand Use – Mop incl – V400 £63.90 |
|
|
MAKITA HR2510 SDS+ VAR SPEED ROTORY HAMMER DRILL 110V £9.95 |
|
|
HS102 Hot Air Gun 2000W 3-Speed 50-600degC Var Heat £119.89 |
|
|
NOS MOPAR 1957-63 VAR SPEED WIPER MOTOR SWITCH PLATE £28.47 |
|
|
NOS MOPAR 1971-2 CHRYS IMPERIAL VAR SPEED WIPER SWITCH £41.12 |
|
|
NOS MOPAR 1955 Plymouth Var Speed Windshield Wiper Swch £22.14 |
|
|
NOS MOPAR 1968 VAR SPEED WIPER MOTOR SWITCH PLATE £31.63 |
|
|
Black And Decker KW900EKA Router Var Speed 1200 Watt £58.99 |
|
|
Bullet And Sur-Speed Records Rock’N'Roll – Var (NEW CD) £8.99 |
|
|
Draper 650W Var Speed Orbital Jigsaw LED Light [45810] £91.94 |
|
|
Metabo SXE 450 Var Speed Orbital Sander 150mm 240V £219.78 |
|
|
DeWalt D26203 1/4in 8mm Plunge Router Var Speed 110V £376.87 |
|
|
Metabo SXE 450 Var Speed Orbital Sander 150mm 110V £219.78 |
|
|
DeWalt D26203 1/4in 8mm Plunge Router Var Speed 240V £376.87 |
|
|
Hitachi M12v2 240v 1/2in Var Speed Router n MouldedCase £314.31 |
|
|
Hitachi M12v2 110v 1/2in Var Speed Router n MouldedCase £1,091.31 |
|
|
NOS MOPAR 1957-64 VAR SPEED WIPER MOTOR GEAR & GASKET £28.47 |
|
|
NEW Draper 14.4 volt Cordless Hammer Drill 3- 5 hour Charger 1 Battery Var Speed £39.99 |
|
|
DeWalt D26203 1/4in 8mm Plunge Router Var Speed 240V £370.37 |
|
|
DeWalt D26203 1/4in 8mm Plunge Router Var Speed 110V £370.37 |
|
|
Hitachi M12v2 240v 1/2in Var Speed Router n MouldedCase £307.81 |
|
|
Hitachi M12v2 110v 1/2in Var Speed Router n MouldedCase £1,084.81 |
|
|
Metabo SXE 450 Var Speed Orbital Sander 150mm 240V £213.28 |
|
|
Metabo SXE 450 Var Speed Orbital Sander 150mm 110V £213.28 |
Danfoss VLT Variable Frequency Drive Exposed