ActionScript 2.0 :: Counting / Pausing & Resetting Variables

May 27, 2008

What I'm trying to do:

1) Have a textfield that counts from 1 to 315
2) Once the value of the textfield reaches 315, pause for 2 seconds, and loop.
3) Do this until 15 seconds have passed, then stop.

What I've done so far to try and get this to work:On frame 1, I set up a little script like so:[code]The problem is, once it loops back to frame 1, my textfield that is being displayed continues to display 315, it won't display the counter going from 1 to 315. EVEN THOUGH IF I TRACE IT, you can see the script is working in the background just fine counting from 1 to 315 3 more times before 15 seconds is reached.Any idea why my textfield would be displaying the end value and not displaying the start (counter) value as it should?

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Setting Limits On And Resetting A Counting System?

Mar 12, 2012

So I'm making a simple counter to be used to keep a tally of 10 different categories, plus a total tally of all 10 categories combined. there are 10 buttons and 11 dynamic text fields. When each button is clicked, it will add to the text field that relates to it, plus add to the "total score" tally. I've got all of the buttons working correctly as of now.

However, I would like to set a limit on the total tally at 100 and am unsure how to do so right now.

I also have not been able to program a reset button correctly. I can make the text boxes revert back to 0, but it seems flash is still keeping the total tally because when I start counting again, the scores start where they left off.

[Code]...

View 5 Replies

ActionScript 3.0 :: Resetting MovieClip Between Levels And Passing Required Variables

Nov 25, 2010

I'm currently working on my first flash game and have managed to near enough get everything working. I can play each level individually by manually changing the variable 'level =' (to whichever level I want to play) in the actionscript. Now I need to find out the correct way to reset the movie after each level but still pass the 'currentTime' Timer variable and the 'level' variable over... Would I use variables I have saved in the init() function...

View 16 Replies

ActionScript 3.0 :: Counting Files In Folder With Same 2 Variables

Apr 8, 2010

Here is my code:
var vi3585 = 0;
var loader:URLLoader = new URLLoader();
//telling the loader that we are dealing with variables here.
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
//This is an eventlistener
loader.addEventListener(Event.COMPLETE, loading);
[Code] .....

I have dynamic number of files inside a folder. Every file has 2 variables in it vt11 and vt11s. I need a script that checks if the variables in the files have certain values and if it has this value than it counts this file. Basically what this script does is that it counts how many files in the folder have the same 2 variables in it and than displays this number in the text box. The above script always shows 1, no mater how many files with the same 2 variables are in folder.

View 1 Replies

ActionScript 2.0 :: [Flash 8] Getting Variables For Score Counting?

Nov 24, 2005

I am creating a simple game where you must remember the name of a number of people. On the stage is a table with faces. Text appears, asking who, for example, "Mike" is. You then have to click the correct face. The questions appear randomly.I have come this far, but what I want to do is the following:

1) Restrict the number of random questions, presumably by adding a variable, with the value incrementing by each question, and tells the movie clip to go to the "game results" frame when reaching a certain number.

2) Keep track of the number of questions answered correctly/incorrectly. I suppose this is also done easily by adding a value for number of incorrect answers, which is increased for each incorrect answer, with the amount of correct answers being calculated like (total number of questions)-(incorrect answers).

3) Display the number of correct and incorrect questions on the "game results" frame. For example "You answered X number of questions correctly, and Z number of questions incorrectly".

I know that the pieces of code below should be used, but I don`t know how to put it all together, or where to put it. I suppose the main code should be in the first frame, and some should be in the buttons.

Code:
var questionsAsked:Number;

Code:
myValue++;

Code:
if (questionsAsked == 20){
gotoAndStop("results");
}

View 3 Replies

ActionScript 3.0 :: Counting The Number Of Variables In A .as File?

Apr 26, 2010

I made a .fla file that uses an "include" to pull in a bunch of variables from a .as file. I would like to be able to count the number of variables in this file so that I can make the thing more "automatic" so that if someone else in my office adds more variables to the .as file it updates itself. Similar to the way you can count children using an XML file.

View 4 Replies

Actionscript 3.0 :: Counting Down Instead Of Counting Up

Jan 15, 2009

I created a timer with found tutorials and the Flash help files and everything works fine. My timer counts up from 000.000,0 to 999.000,0. Now I would like to also be able to do the same, but counting down from 999.000,0 to 000.000,0
Easy enough I thought, but now . how to make some modifications in my code to count down.

My code for counting up is the follow:

Code: Select allvar hours:Number = 0;
var seconds:Number = 0;
var minutes:Number = 0;
var pauseTime:Number = 0;

[Code].....

View 2 Replies

Variable Changing But Then Resetting

May 25, 2011

I'm very new to Flash, but I have been learning loads and getting some good results so far. Browsing these forums has been a massive help. However today I have hit a problem in what should be almost the simplest line of code I know how to write (variable = x), and could do with some advice. I have a simple program containing a button which will change a variable when pressed. There is also a text-box that will output that variable. However when I press the button, the variable will change, but then immediately revert to it's previous value.

[Code]...

View 3 Replies

ActionScript 3.0 :: Variable Resetting Itself?

Jan 1, 2011

I made a simple class that's keeping a history of strings, updating it with a push() method (like an array) and with a possibility to navigate with next() and previous().Therefore my class has an array and a integer indication the current position in the array. (See full code below)Now something very strange is going on. When coming into the push() method the position variable has some value, which I can change, but everytime I try to read that variable, it gives me a 0. I've never had this kind of problem before and I simply cant find out what's wrong.The push() method

ActionScript Code:
public function push(entry:String):void [code]......

View 3 Replies

Actionscript 3.0 :: My Score Keeps Resetting

Jan 14, 2010

I have a character on the stage in my fla that when hitting a particle created in an a particle.as removes the particle. I have the code for removing the particle and also a score counter that adds one everytime a particle is removed (located in my particle.as). My problem is the score keeps resetting or I get sporadic results (not sure which) for example here I traced the results[code]...

View 1 Replies

ActionScript 2.0 :: Resetting The Scrollbar?

Mar 11, 2004

How do you reset the scrollbar in Flash? (I'm using the component, not a cusom scrollbar.)If you go here, scroll ALL the way to the bottom and then click on "Donations" - you'll see the scrollbar stays in place.How do I get it to refresh each time new text is loaded? I've tried refreshPane() and a few other things, but nothing works.

View 7 Replies

ActionScript 2.0 :: Resetting Comboboxes?

Jul 16, 2003

How do you reset combo-boxes?I have this form with combo-boxes and input textfields, and I want a button that can reset the form.The input textboxes are easy:TextBox1.text = "";

View 5 Replies

ActionScript 3.0 :: Combo Boxes Resetting?

Jan 26, 2009

I have created a menu for an online café. The displayarea is limited, so the menu items need to scroll within a frame ofsome sort.

View 4 Replies

ActionScript 1/2 :: Resetting Operations In Particular Frame

Nov 6, 2009

I've created a application where the viewer could change colours, add text, add logos, rotare them, etc... How do I create a reset button which resets everything to back normal in a specific FRAME? What functions do I have to use?
E.g.
Frame 5 is used to Add colours and text, etc...
Frame 10 is used to Add logos,scale them, rotate them, etc...
I need a reset button in Frame 5 to make only the things which were changed back to normal.

View 1 Replies

ActionScript 1/2 :: Tween Class Not Resetting Y Value

Jan 11, 2011

I am trying to move a movieclip down using Actionscript. Then when a user fires a back event [which is successfully firing] the movieclip is then required to go up again. The code is:

trace("fholder _y org: " + folioholdermc._y);
// THIS COMES OUT TO BE -601
var yDown1:Tween = new Tween(folioholdermc, "_y", Bounce.easeOut, -601, -449, 3, true);
trace("step 1 called");
trace("fholder _y down1: " + folioholdermc._y);
[Code] ......

View 3 Replies

Actionscript 3 :: Resetting Objects In Flash CS5?

Mar 16, 2011

I'm making a simple platform game in Flash CS5 and Actionscript 3.0. When the player loses all their lives, I want it to redirect the player to a "Game over" screen where they can select a "Try again" button to restart the game.

Set everything (player, background, etc) to visible = false
Set "Game over" movie clip to visible = true (it is invisible during gameplay)

Have the button in the "Game over" movie clip hide the movie clip then re-show all the gameplay elements.Reset position of player to start, set score to 0, lives to 3, etc..It's probably not a very good way of doing this but if it works, then I'm happy. I just want the "Game over" screen to show briefly and if the player clicks the "try again" button, they can play from the start.

Now, the problem with my implementation of the above is that when I set all the gameplay elements to visible = true after having them set to false, the game has stopped.. keyboard input doesn't reactivate and the game elements are shown but aren't active. Is there something about the visible attribute I don't know? Does it mess with the "state" of an object? Here's some snippets of code from the Actionscript file...

if(lives >= 0) {
//print number of lives
}[code]..........

View 2 Replies

ActionScript 2.0 :: Resetting X And Y On Draggable Movieclips

Feb 3, 2009

I've got 6 draggable movie clips that snap to a target - which works fine. If they don't hit the target area they snap back to their starting point- which also works fine.

My problem is that they can all be dragged to the target one after another, but I only want one movieclip to be at the target at any one time.

So,when I start dragging a new clip toward the target I want the movieclip thats already on the target to reset itself to it's starting position, thus being replaced by the incoming clip.

I want this to happen for all the draggable clips.

function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;

[Code].....

View 3 Replies

ActionScript 2.0 :: Stop Animation From Resetting?

May 22, 2010

I'm making a flash game. when i open the dresser drawer, then leave, then come back the drawer is closed.

how can i make it so when i come back the drawer is still open?

View 1 Replies

ActionScript 3.0 :: Resetting A Class Instance?

Dec 29, 2010

im creating this game. I have a main class, which I use to call the menu class and the actual game(board) class.

I got the game working, but now when I try to reset the instance of the board, it doesnt actually execute the constructor again. So I get a fresh board, but the variables aren't reset.

ActionScript Code:
public function Resetboard(event:Passboolean){
board = null;
board = new Board();
application.addChild(board);
}

View 9 Replies

ActionScript 2.0 :: Resetting Multiple MovieClips?

Jan 24, 2011

I've created this simple birthday game where the concept is to blowout 30 candles in 15 seconds.The candles are movieclips so that when they are clicked on, they blowout. However,when the option to "try again" begins, the candles are still out.

View 9 Replies

ActionScript 2.0 :: Sound.position Not Resetting

Oct 25, 2005

Just to start off, this isn't exactly an inquiry to a problem. It is moreso of a posting of a bug (or assumed bug) in the Flash player and how to get around it. Though if anyone else has a better method then share. Ok, well I very rarely ever work with the Sound() object in Flash, and I found myself working with it today. I was having a problem and I could not pinpoint it for the life of me.... my code appeared correct in every aspect.

After tracing many sections of my code to find out where it was going wrong I realized... that for some reason when you use Sound.stop(), the Sound.position doesn't get reset... it instead just increments from where it left off. This is quite annoying. And being that Sound.position is a read only property you can't reset it yourself. The only solution I have found for this is to delete or overwrite your Sound() object with a new Sound() object. Anyone know if this is indeed a bug, or if there was some reason Macromedia did it like this?

View 9 Replies

ActionScript 2.0 :: Resetting Movieclip States?

Jan 16, 2006

I know there are similar questions here that have been answered, but after trying to make sense of it, I still can't get this to work.Based on an array, I attach a number of MovieClips from the Library.On release they go to a certain frame, representing the "pressed" state of the button.The problem is, that I can't figure out how to reset the last pressed button back to it's original state...Here is the Actionscript code I have so far:

ActionScript Code:
stop();
daCap.play();
scrollUp._visible = false;[code]......

View 5 Replies

ActionScript 2.0 :: Resetting Movieclips Position?

Sep 7, 2006

I have a setup where a girl is holding a card on there are words on each card and as time goes by they fall to the ground. The problem I am running into is that the cards never go back into the loop of cards, once they are out I am just left with a blank card. How could I have it reset this?

Code:
//CLASS IMPORTS
import mx.utils.Delegate;

[code].....

View 1 Replies

IDE :: Scrollpane: Resetting Scrollbar Position?

May 18, 2009

In my main .fla I have a scrollpane which opens an external SWF, inside this external SWF I have 5 frames, each with a 'Next' button at the bottom, the problem is when the user clicks the 'Next' button the the scrollpane doesn't change the position of the scrollbar, so essentially the user is looking at the bottom of the next frame. Is there any way to reset the scrollbar position from either the external SWF (linking to the main SWF), or with some code in the main SWF?

View 3 Replies

ActionScript 3.0 :: For Loop Counter Not Resetting

Jun 16, 2009

so I have a class method that contains a for loop ... however, each time I call the class method, the for loop counter continues to count from where it left off! Agh - the loop counter get's reset?

[Code]...

View 10 Replies

ActionScript 3.0 :: How To Stop A Variable From Resetting

Dec 9, 2009

I've got a list in a flash app that when an item is clicked it should add a number to a dynamic text field, my problem is that the variable I declare to store the number in either always resets to 0/ doesn't add the numbers or returns NaN.

The variable in question is

Code:
var totalNum:Number;

What I want it to do is add the numbers when a list item is selected, e.g. totalNum starts at 0, if item 1 is selected totalNum should now be 1, if item2 is then selected totalNum should be (1+2 = 3), instead the label just displays 1, then 2.

I've tried declaring the variable outside of the event, but that resulted in the label showing NaN, unfortunately (as far as my understanding goes) declaring it inside makes it a local variable which resets each time the event is called and I'm not sure how to get around this (I can't seem to get the syntax for global variables right)

An example of my code is:

Code:
list1.addEventListener(Event.CHANGE, ItemChange);
function ItemChange(event:Event) {
var Item = event.target.selectedItem.data;

[Code]....

View 2 Replies

ActionScript 3.0 :: Resetting A Countdown Timer To A New Value?

Jan 12, 2010

I made a ten minute timer that starts at 600 and counts down to zero. It displays the current count in a textfield called "textfield_time". Here's what it looks like:

Code:

var timer:Timer = new Timer(1000, 600);
timer.addEventListener(TimerEvent.TIMER, countdown);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, termin);

[Code]...

I have a time pickup that floats across the screen now and then. When your avatar makes contact with it, you get extra time - say 15 seconds. I already have working code that detects the collision of the avatar and the pickup, but I can't figure out how to add functionality to reset the timer to give an additional 15 seconds. I tried:

Code:
timer+=15;

which doesn't work. But you already knew that (hey, I'm new at this!). Maybe some way to get the currentCount value, increment it by 15 seconds, then update the timer value with it?

View 8 Replies

ActionScript 3.0 :: Highlight/Resetting MC Button?

Jan 20, 2010

What I'm trying to do is highlight a movieclip button when it is clicked, and then remove that highlight when another movieclip button in the same menu is clicked.I think the problem is arising from the fact that the buttons temporarily highlight when rolled over. I have used the 'ROLL_OVER', and 'ROLL_OUT' event listeners to initiate the animation, so any attempt to keep the current button highlighted is quashed when the mouse is moved off the button.here is some of the code i have used

[AS]overview_btn.addEventListener(MouseEvent.ROLL_OVER , highlightMenu);
photography_btn.addEventListener(MouseEvent.ROLL_O VER, highlightMenu);
overview_btn.addEventListener(MouseEvent.ROLL_OUT, UNhighlightMenu);

[code].....

View 1 Replies

ActionScript 2.0 :: Flash8 Resetting MC's To Original Place?

May 16, 2009

Right now I am in the beginning stages and I have it set up so you can drag different sounds to the timeline (in the game, not in flash) and it'll snap in place which works perfectly.

But here's my problem: When I try to click the reset button the sounds snap to their original places (which sounds good right?) but then they tween back to where you dragged them on the in-game timeline.

I have put in various codes and no matter what I try, when I click the reset button, they always go back to where you dragged them to the timeline, making the reset button pointless.

Here's my code on the Flash timeline:

Code:
function dragSetup(clip, targArray) {
clip.onPress = function() {
startDrag(this);

[Code].....

I know, I know, that whole s(N) thing is very beginner but I didn't know what else to use, and it worked fine.

View 1 Replies

ActionScript 3.0 :: Resetting A Drag And Drop Game?

Jul 14, 2009

I'm having trouble reseting a drag & drop game. It is a movie clip with two pages: start_pg and game_pg. On start_pg is a start button (start_btn) that goes to game_pg. On game_pg is button (end_btn) that goes back to start_pg. Both buttons share the same layer, so I made each invisible when not of its page. The game works fine, but when the end_btn is clicked, all movie clips that have been dropped, stay there.How can I go back to start_pg and reset all movie clips to their original starting point?
 
// start game pagestop();
end_btn.visible=false;start_btn.visible=true;
start_btn.addEventListener(MouseEvent.CLICK, goGame);
function goGame (Event:MouseEvent): void{ gotoAndStop("game_pg");}

[code]....

View 12 Replies







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