ActionScript 3.0 :: Score Keeps Resetting - Getting Sporadic Results
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;
16
17
24
18
7
23
24
25
On the stage I have a dynamic text field called score_txt, that displays my score.
Code:
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
import flash.utils.Timer;
[Code] .....
View 1 Replies
Similar Posts:
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
Apr 7, 2011
I am working on an eLearning lesson that needs to score quiz results using a statistical formula called a probit function. There are formulas in many languages (VB, C++, etc.) for the probit function, but not in AS3. The closest I can find is in JavaScript.
[Code]...
View 8 Replies
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
Jul 8, 2008
I have a flex app that polls a php script every 1-2 seconds and returns new data. The polling is done with a URLLoader.load call;the requests are HTTP GETs. The app listens for Event.COMPLETE, handles the incoming data, waits for 1 second, then makes another URLLoader.load call.
This process works perfectly for any duration from 4 to 20 minutes. Eventually, a URLLoader.load call fails to return Event.COMPLETE. Instead it hangs for 60 to 180 seconds (depending on which local network I'm using for internet access) and finally returns an ioErrorEvent.IO_ERROR with the message "Error #2032: Stream Error. URL: <mysite.com/foo.php". The app tries to make another URLLoader.load call, but from this point onward, none of the loads return Event.COMPLETE. Also, none of these post-error HTTP GETs appear in the access.log file of my apache (2.0.55) webserver. The app will not work again until I close and reopen the browser.
I've spent several days trying to figure this out! The time until the app crashes appears to be completely random. The problem occurs in both Firefox (2.0.0.15) and IE (7.0.5730.11). I've read that sometimes 2032 errors can be related to caching, but there's no directives (in .htaccess file or httpd.conf file) that sets the Pragma or Cache-Control response header to "no-cache".
I can't tell if the problem is on client or server end. Based on the adobe language references and the forum posts I've read, this seems to be an appropriate use of URLLoader. (In case you're wondering I want the app to respond to events in near real-time. I originally used xmlsocket to push data to app from server. However, this communication is blocked by corporate firewalls, so I need an alternative method)
Here is (cleaned up) code:
[Code]...
View 1 Replies
Jun 1, 2011
The slider thumbs in my Flex 3 application usually work correctly, but often they seem to become insensitive to mouse downs on what should be thumbPress events. It turns out that mouseOut events are being fired as the mouse moves away from the edge of the thumb towards the center. The thumb is sensitive to mouseDown events only when it is in the "over" state.
I am seeing the same behavior: Displaying the default thumb rather than my custom class Using a hitArea sprite (I tried a child TextInput sized to cover the thumb with alpha 0). Can anyone suggest either a fix or a workaround? I can identify the faulty mouse out events, but then don't know how to compensate, for example, by reestablishing the "over" state, or perhaps with programmatic control of the mouse.
View 1 Replies
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
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
Feb 11, 2009
I recently migrated to Flash CS4 from Flash 8 and occasionally there is a bizarre jolt that briefly shifts all the panels before returning to normal. Is this a glitch? I'm running Windows XP 32-bit. I've noticed this across all workspace layouts I've used so far.
View 1 Replies
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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