View Full Version : Calculating scores between swfs
Hi,
I'm trying to make a game which requires a main swf to calculate 3 scores from 3 different swfs...
My main file is main.swf
The 3 files are level1, level2 and level3
I just need to add the score from each of the above files and depending on the outcome, run an animation on the main.swf.
Can anyone help me with this please?
Thanks in advance
atomic
11-02-2007, 03:44 PM
Are the files really loaded on other levels, or is that just a figure of speech and the different levels are in fact loaded in a container clip within the main movie?
You should maybe attach your .fla(s).
Hi,
Thanks for replying. Please see the Flash files attached, I have the main.swf which declares the score as 0 in the first frame. In the files named level1, level2 and level3, I'm incrementing the score value by 1 if the button on the screen is pressed. Back on the main.swf, I have stated that if the score is 3, trace ("you win")...what am I doing wrong?
Thanks again
atomic
11-02-2007, 06:13 PM
Try this...
loadMovie("level1.swf",1);
_global.score = 0;
this.onEnterFrame = function(){
trace(_global.score);
if (_global.score == 3){
trace ("you win!")
delete this.onEnterFrame;
// other actions here...
}
};
It worked, thanks very much; I really appreciate this! Could I ask what the line
"delete this.onEnterFrame;" does?
atomic
11-02-2007, 09:07 PM
It deletes the onEnterFrame function, that was used to constantly monitor the value of score, because it's no longer needed, when your condition is met... It's just better practice, to delete unneeded onEnterFrame's, rather than letting them run on, which it will do if you don't delete it, adding unnecessary stress on the processor...
Right, I get it now, thanks so much for that :)
atomic
11-03-2007, 05:09 PM
Grrrrrrrrrreat! ;)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.