Dit is het script van de Musquito-killer dat als voorbeeld wordt gebruikt bij Flash 5. Nu komt de vraag: aan de variabele count wordt nergens een waarde toegekend. Maar dit wordt, tenminste dat denk ik, door "createMosquitos(level);" gedaan. Maar volgens welke regel (ik wil dus horen waar dat ergens in de manual staat dat dat inderdaad klopt) is het zo dat de variabele die dan in die functie staat (level) de waarde doorgeeft aan count?
Scene 1
actions for frame 1
function createMosquitos (count) {
// create mosquitos
var i;
for (i=1; i<=count; i++) {
_root.attachMovie("mosquito", "mosquito"+i, i);
}
}
function changeCursor (movieclip) {
// create custom cursor
Mouse.hide();
_root.attachMovie(movieclip, "customCursor", 9999);
_root.customCursor.startDrag(true);
}
function calculateRandom (min, max) {
// random with the math object (Flash 5)
return Math.floor(Math.random()*(max+1-min))+min;
}
function playSound (max, x, soundID) {
// play stereo sound depending on the x-position of the action
var soundobject;
soundobject = new Sound();
soundobject.attachSound(soundID);
if (x<0) {
x = 0;
} else if (x>max) {
x = max;
}
soundobject.setPan((x-(max/2))*100/(max/2));
soundobject.start();
}
actions for frame 1
// init for standalone player
fscommand ("fullscreen", true);
fscommand ("allowscale", true);
fscommand ("showmenu", false);
// init
level=0;
hit=0;
score=0;
changeCursor("swatter");
actions for frame 3
if (hit==level) {
if (level<8) {
// limit to 8 mosquitos
level++;
}
hit=0;
createMosquitos(level);
}
prevFrame ();
play ();
actions for frame 1
// (c) 2000 Sascha Wolter
// wolter@flashforum.de
actions for credits button
on (release) {
getURL ("http://www.flashforum.de/contact");
}
Symbol Definition(s)
Scene 1
actions for frame 1
function createMosquitos (count) {
// create mosquitos
var i;
for (i=1; i<=count; i++) {
_root.attachMovie("mosquito", "mosquito"+i, i);
}
}
function changeCursor (movieclip) {
// create custom cursor
Mouse.hide();
_root.attachMovie(movieclip, "customCursor", 9999);
_root.customCursor.startDrag(true);
}
function calculateRandom (min, max) {
// random with the math object (Flash 5)
return Math.floor(Math.random()*(max+1-min))+min;
}
function playSound (max, x, soundID) {
// play stereo sound depending on the x-position of the action
var soundobject;
soundobject = new Sound();
soundobject.attachSound(soundID);
if (x<0) {
x = 0;
} else if (x>max) {
x = max;
}
soundobject.setPan((x-(max/2))*100/(max/2));
soundobject.start();
}
actions for frame 1
// init for standalone player
fscommand ("fullscreen", true);
fscommand ("allowscale", true);
fscommand ("showmenu", false);
// init
level=0;
hit=0;
score=0;
changeCursor("swatter");
actions for frame 3
if (hit==level) {
if (level<8) {
// limit to 8 mosquitos
level++;
}
hit=0;
createMosquitos(level);
}
prevFrame ();
play ();
actions for frame 1
// (c) 2000 Sascha Wolter
// wolter@flashforum.de
actions for credits button
on (release) {
getURL ("http://www.flashforum.de/contact");
}
Symbol Definition(s)