Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-02-2007, 01:03 PM   #1
pdvk
Registered User
 
Join Date: Oct 2005
Posts: 7
Default 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
pdvk is offline   Reply With Quote
Old 11-02-2007, 02:44 PM   #2
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

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).
atomic is offline   Reply With Quote
Old 11-02-2007, 03:41 PM   #3
pdvk
Registered User
 
Join Date: Oct 2005
Posts: 7
Default calculating scores

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
Attached Files
File Type: zip level3.zip (23.9 KB, 137 views)
pdvk is offline   Reply With Quote
Old 11-02-2007, 05:13 PM   #4
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

Try this...

ActionScript Code:
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...     } };
atomic is offline   Reply With Quote
Old 11-02-2007, 06:16 PM   #5
pdvk
Registered User
 
Join Date: Oct 2005
Posts: 7
Default

It worked, thanks very much; I really appreciate this! Could I ask what the line
"delete this.onEnterFrame;" does?
pdvk is offline   Reply With Quote
Old 11-02-2007, 08:07 PM   #6
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

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...
atomic is offline   Reply With Quote
Old 11-03-2007, 10:07 AM   #7
pdvk
Registered User
 
Join Date: Oct 2005
Posts: 7
Default

Right, I get it now, thanks so much for that
pdvk is offline   Reply With Quote
Old 11-03-2007, 04:09 PM   #8
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

Grrrrrrrrrreat!
atomic is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preloader for loading multiple external swfs jschjol ActionScript 2.0 1 05-09-2007 02:22 PM
Preloader + multiple swfs kaziorvb Components 6 11-09-2006 08:29 PM
Passing variables between swf's hothousegraphix ActionScript 2.0 10 06-26-2006 09:18 PM
loading swf's within swf's Milk ActionScript 1.0 (and below) 11 06-29-2003 06:41 AM
preloading child swf's into parent "main" with a twist! DrumDesigner ActionScript 1.0 (and below) 1 10-19-2001 01:46 PM


All times are GMT. The time now is 12:38 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.