ActionScript 2.0 :: Keeping Score With If Statement

Dec 15, 2010

I'm having an actionscript 2.0 problem with keeping score. I have a dynamic text box with a variable called score. I have the following action code for that variable:

_root.score = 0;

For the correct answer button I have this action:

_root.score = Number (score) +10;

This works fine to increase the score by 10 for each correct answer. The problem is that I can't get an if statement to work for when the score reaches 150 to gotoAndPlay a certain frame. I've tried various syntax, I've tried it on the action for a button and an action for the timeline with:

onRelease = function () {

(My learning game is set up to allow for users to answer up to four extra questions to reach the score of 150). Nothing has worked so far.

View 5 Replies


Similar Posts:


ActionScript 2.0 :: Getting A NaN Error On 'Keeping Score' Tutorial

Mar 1, 2007

I recently did the tutorial on here called "Keeping Score" - where you can click on one button and it will add score to a dynamic text field. Press another and it will subtract. I wanted to take this one step further - although have run into some problems.I have set my stage up so that the MCcontainer loads up a random movie clip each time.. from external SWF's. The idea was to have you click on the random swf's when the pop up and add points.. to the dynamic movie clip on the main stage. Although I end up getting a NaN in the score box.However if I click on a button with the same script in the main movie (not externally) it will add to the score.. and then if I click on the external movie it will add points correctly.[code]I have made sure that it relates to the root - and it only works once a button has been pressed with the same code in the main timeline of the movie, but messes up if you click on the external SWF first.

View 2 Replies

ActionScript 2.0 :: Keeping Track Of Score On A Leader Board?

Jun 10, 2010

I create a password and go to save the password and get an error saying it not in the table.The error was because i had to press generate php code.That was so fustrating. couldnt belive it . Ive just wrote the answer now if any 1 else has the same error. It was annoying .

//__________________________________________________ ___________________________________
http://library.creativecow.net/artic...o-tutorial.php
<?PHP

[code].....

View 2 Replies

ActionScript 2.0 :: Comparing Strings Over 2 Levels And Keeping Score?

Oct 1, 2002

I am trying to do a string compare over 2 levels.As you will see when you run the game, When you select the radio buttons and click continue the values are passed to the next movie under the You selected column. I want to compare these with the values in the Correct Answer column.

I have a count that is supposed to be incremented if a string compare is successful (in actions in answers_train.fla), the final value of count is placed in the dynamic text field _level1.score and then it checks the value of count and places a statement in _level1. statement.However my string compare doesnt seem to be working?

View 1 Replies

Actionscript :: Add Score Tracker In An If / Else Statement For Multiple Choice Game?

Dec 12, 2010

Where and how I'd put the rest for the score tracker? I'm going to be making 3 of these multiple choice questions, so what would be the best way I lay that out and transition from one question to another?[code]...

View 1 Replies

ActionScript 3.0 :: High Score Table Setup - If Statement With Variable

Feb 9, 2010

I am trying to get a high score table set up and I have it all working except for an if statement which decides whether to put a zero in the time or not.
ActionScript Code:
variable declared at the top
var gap:String;

This is getting data that is stored - it works fine except for the underlined "gap" - The "gap" is meant to be calling the variable which has the below if statement
ScoreInputScore.text=String(SpotTheDifferenceGame._minute)+gap+String(SpotTheDifferenceGame._second);
if (SpotTheDifferenceGame._second<10) {
gap=(":0");
} else {
gap=(":");
}

I thought by have the variable called in in the function and having the if statement with gap= it would do the specified text in the dynamic text box. When I put a trace on "gap" it traces with the correct text depending on what the number is but in my dynamic text box it displays as number null number.
// displays like this when trace put on it
:0
// displays like this in dynamic text box
2null02

View 1 Replies

ActionScript 2.0 :: Get Score Text Box To Gotoandplay Another Frame - Scene When It Hits A Certain Score?

Aug 10, 2004

Im designing my own game in flash, iv set up a score text box and it works fine. Except i just cant seem to get it to gotoandplay another frame,scene, when it hits a certain score??

View 4 Replies

ActionScript 2.0 :: Score - Movie Go To Frame 3 If The Score = 500?

Feb 17, 2004

i am building a shooting game and i was wondering if it is possible to have the movie go to frame 3 if the score = 500.I.E Score is displayed in a dynamic text box and everytime the enemy is hit the:

_root.score +=50
=============
on the first frame of the film i have the code

if (_root.score == 500) {
gotoAndPlay(3);
}

View 2 Replies

Actionscript 3 :: Multiple Dynamic Text Score Display - Modifying Each Text One After Another And Incrementing The Score By A Certain Number

Feb 23, 2011

I have a result screen that shows bonus points and such. I want each text field to increment one after another and also have it increment by a certain amount each frame. Result Screen pops up. First is the player score check the player score, is it more than the score we want to display if the player score is greater than the player display score by 100 increase the player display score by 100 if the player score is greater than the player display score by 10 increase the player display score by 10 else increase the player display score by 1 when finished move to the next score...and so on. I have thought of using timers to move from one score to the next, but not being in an Event.ENTER_FRAME it only does one if then moves to the next one.

Also the if statement for incrementing the score looks ridiculous and I'm thinking there has to be a better way to do it. I was thinking of making it a separate function but then I wouldn't know what to return, or how to return it so it looks like its increasing and not just showing the total number instantly. I'll try to expand on it a little more.

View 1 Replies

ActionScript 2.0 :: First Requirement Of The If Statement When Type In The Proper Input And Go Straight To The Else Statement

May 14, 2009

Having a few problems with what I thought was a simple if statement. Here is the code:

[Code]...

I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.

View 7 Replies

ActionScript 1/2 :: Execute Code In Previous If Statement If Second If Statement Is Executed?

Aug 31, 2011

if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code

[Code]...
 
I dont want to copy the code from the first into the second and the first and second into the third.
 
My mind isn't working and there is probably an extremelly simple way to get this working.
 
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.

View 7 Replies

ActionScript 2.0 :: Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails?

Oct 10, 2008

The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {

[code]....

The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

View 1 Replies

ActionScript 2.0 :: If Statement Inside If Statement Won't Work

Mar 30, 2011

why this code won't work

[Code]...

I'm sure you can put if statements inside other if statements, seriously I can't figure it out

View 4 Replies

ActionScript 3.0 :: Another 'if' Statement Inside An 'if' Statement?

Sep 22, 2010

I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.

View 13 Replies

ActionScript 3.0 :: Use A For Statement To Create An If Statement

Jul 12, 2010

what I'm trying to do is create an else if argument for each object in an array based on a user set number

Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}

to which I want it to GENERATE THE FOLLOWING CODE:

Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}

the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?

View 4 Replies

ActionScript 3.0 :: Write Another "if Statement" Inside Another If-else Statement?

Sep 22, 2010

I have a script which is giving me a lot of trouble since I have no idea how to write another "if statement" inside another if-else statement. I keep getting errors, I guess I don't know where to put the braces exactly...

example:
if(bla == bla) {
<------------how would I write another if statement here?
}else if (bla == bla){
}

View 3 Replies

Keeping One Image On Top?

Aug 15, 2009

I have created a website header that rotates through various images. I have another image that I would like to be off to the left side but partially cover the main header images. I really don't want this image to change with the other images. Is there a way to put this image on its own layer in flash and have it visible the whole time, while the other images change?

View 2 Replies

Keeping One Object Above Another?

Sep 14, 2009

i am doing a mario game with flash, as3. i want to mario stay above box when jump above it or i dont want mario to pass through box while walking. mario should crash box like wall.

View 3 Replies

Keeping Object On Screen

Aug 12, 2011

I'm making this banner, or FMA if you rather call it that, for a company (school assignment). I have some text fading in and out displaying the message. But I want an interactive FMA.I want to make some buttons, and when you go mouse-over on them, I want a picture to be displayed (different image for each button), WHILE the animation keeps going. Thats not the tough part.However, when the animation repeats (starts from the beginning), and if I'm holding the cursor over the button connected to the picture, the picture disappears and I have to go over the button again. [code]

View 1 Replies

Actionscript 3 :: Fit A Swf Into A Box Keeping The Same Ratio?

Jan 17, 2012

I have an as3 app that loads SWF's with various movie clips inside with a size of 1280 width and 720 height. I would like to fit these SWFs into a content box of height 885 width by 500 height. The SWF must keep a ratio of 1.77. This would be easy if as3 recognised the SWF being 1280 height by 720 width. It doesn't however, and takes the size of the movie clips inside the swf which varies (as long as it's within the original size boundaries). how I can make the SWF's fit into the content box even if the movie clip sizes and therefore the original SWF sizes vary?

View 1 Replies

ActionScript 2.0 :: Keeping One Or Two Decimals?

Aug 25, 2009

I know how to remove all decimals with:

ActionScript Code:
Math.round (xTwo*0.39);

But, how do I keep 1 or 2 decimals?

View 6 Replies

ActionScript 2.0 :: Keeping A Clip On Top?

Aug 6, 2006

I need to use a custom cursor.I am doing so by simply hiding the cursor and having a small MC follow the mouse around with a setInterval.I need to make sure the cursor stays at the highest level. The stage is blank and all content is loaded using script. I was just setting up the cursor at the end of the script and using getNextHighestDepth. That was working fine, but now I need to load external stuff into the movie. How can I set up my cursor so that it will stay above all the other clips, regardless of when they are loaded?

View 3 Replies

IDE :: Keeping The Projector Fullscreen?

Jan 7, 2009

I have created a cd-rom in flash which autoruns and opens up as a fullscreen projector. The cd launches various powerpoint files from without the movie, however, once i close the powerpoint file, the projector is no longer fullscreen.

Is there any way I can keep the flash movie running fullscreen behind the powerpoint files, so when i close them, the flash movie is the same.

View 1 Replies

ActionScript 2.0 :: CS3 Keeping Submenu Visible

Mar 3, 2009

What is the best way to keep a sub menu visible? The way I have it coding, is onRollOver the menu button, the sub menu is displayed. I want the submenu to disappear onRollOut of the entire menu... how would you do this?

View 2 Replies

Keeping Button Image After Click?

May 5, 2009

Does anyone know how to hold a button image after it is clicked? Can you only do this with a movie clip??

View 3 Replies

Keeping An Object On The Stage After Tweening It?

Oct 18, 2009

Let's say I have an object, and I use a motion tween to animate it around. Great. Now, I want that object to stay at the final location while other stuff happens on the stage. I can't figure out an efficient way to do this. You can't copy individual frames of a tween, and copying and pasting the whole tween and breaking it up into individual frames and then removing all but the last frame is a bit... time-consuming.how I might be going about using tweens wrong? I feel like I'm just not doing things the way it was designed.

View 3 Replies

ActionScript 3.0 :: Keeping Object On Top/bottom?

Jul 21, 2009

In my attempt to keep a movieclip on the bottom, I used this code: ActionScript Code:setChildIndex(movieclip,0);However, whenever I play an animation over it that is NOT in a movieclip, it will always cover the animation.For example, I have a shape tween that is not a movieclip. Whenever I lay this movieclip over it with the above code, it always covers the non-movie clip. Is there any way to prevent this?

View 1 Replies

ActionScript 3.0 :: Keeping A Steady Framerate?

Sep 22, 2009

However, there is one issue that plagues a lot of viewers, their players not being able to rend the frames in time.Flash rends each frame on the spot where it is needed, this is obviously needed for actionscripting and similar. But this also means that if a frame takes too long to rend, the player has to do something about it.

The player actually does one of two things, depending on if there is any streaming sounds going on or not.If there is a streaming sound, Flash drops frames to keep in sync. Otherwise, Flash just ignores the issue and draws the next frame as if it didn't have any lag detection.Obviously, neither of these is desirable. What can you do about it? Well, the obvious thing is to not do crazy graphics that takes forever to rend. But what if you can't change the graphics?

There is one thing that you can always do, change the antialiasing level the player is using to do the rending. It's 4x4 (High), 2x2 (Medium) or none at all (Low). This makes the rendering go faster, since it is rendering to less pixels.You can also do other things that are movie dependent to reduce the work load. Things like spawning less particles in a particle effect or outright not having some effects. But those are all movie specific and difficult to work with in a general way.

One idea that I had was to draw everything to a bitmapdata of a smaller size and showing that instead, however, that has it's own issues. For one thing, I do not believe that the player can do it's "changed only" redrawing when you do this. Second, there is the issue if you want the corresponding bitmap instance to be smoothed or not. And of course, if you do this, zooming in will not have the infinite resolution that Flash is known for.Obviously, you need to know when the movie is lagging in order to know when to do this. However, the best I can think of is timing the enterframe events and checking if it has been too long since the last one.
This works to show if you are having issues reaching the target framerate or not, but it does not show the load if you are not having trouble reaching the target framerate.

Now, assuming that we have a metric for how well the playback is working, the big question remains: when do you change the rendering settings? And how do you do it?Yes, it is just a simple property of the Stage class for the antialiasing, but that is not what I mean here. I mean, how do you say if it should be changed or not? When it's even lagging one frame? When it's not lagging for one frame? The same, but for 20 frames? This is something I don't know what to pick.

View 3 Replies

ActionScript 3.0 :: Keeping External SWF In Memory

Feb 22, 2011

So I am loading external swf's. These swfs contain a 16 frame image sequence on the stage. When I load the swf's and go to each frame via actionscript, they load into memory and they play fast and smoothly. If they sit on a single frame for a certain amount of time, the rest of the frames are dumped from memory and the image sequence plays slow again until each frame is displayed and stored in memory again. I really want to keep all the frames of these timelines in memory until I choose to unload the swf's manually.

View 1 Replies

ActionScript 3.0 :: Keeping Track Of Pages?

Mar 2, 2011

I have the code that adds a page number to each page. However, when I go backwards or back to the beginning, the numbers overwrite each other, and will not reset back to zero (first frame)Here is what I am using

ActionScript Code:
var pageCount:Number = 0;
var pageTotal:int = 14;

[code]....

View 0 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved