I am new to action script and i am having a few problems.
I have created a movie in Flash CC with 8 scenes. Scene 6 has an action script that randomly places birds which fly across the screen. Scene 7 has an almost identical script which does the same thing only slower (using a different symbol) and with a couple of variables changed.
The first problem surfaced when testing the movie with the action script only placed in scene 6, it simply did not end at the end of scene 6 and proceeded to play through scene 7 and scene 8.
When adding the script to scene 7, it breaks completely. Testing the individual scenes work fine but when testing the whole movie nothing happens and I get errors.
Here is the action script I am using:
Scene 6
import flash.utils.Timer;
var timer: Timer = new Timer(100, 45);
timer.addEventListener(TimerEvent.TIMER, timerF);
timer.start();
function timerF(event: TimerEvent): void {
var mcClip: Bird = new Bird();
var yVal:Number = (Math.ceil(Math.random()*200));
mcClip.x = -20;
mcClip.y = yVal;
addChildAt(mcClip,10);
}
Scene 7
import flash.utils.Timer;
var timer: Timer = new Timer(100, 40);
timer.addEventListener(TimerEvent.TIMER, timerF);
timer.start();
function timerF(event: TimerEvent): void {
var mcClip: Bird2 = new Bird2();
var yVal:Number = (Math.ceil(Math.random()*400));
mcClip.x = 0;
mcClip.y = yVal;
addChildAt(mcClip,3);
}
These are the errors I get:
Scene 7 (Birds), Layer 'Bird Action Script', Frame 1114, Line 3, Column 5
1151: A conflict exists with definition timer in namespace internal.
and
Scene 7 (Birds), Layer 'Bird Action Script', Frame 1114, Line 7, Column 10
1021: Duplicate function definition.
I need to stop the script at the end of each scene, but I don't know how. I have searched Google and cannot find anything helpful.
Any help would be greatly appreciated.
Many Thanks
