ActionScript 1/2 :: Restart Button Not Working?
May 4, 2009I have a number of scenes and would like to set up a restart button on the last scene to go back to scene 1 and restart.
View 4 RepliesI have a number of scenes and would like to set up a restart button on the last scene to go back to scene 1 and restart.
View 4 RepliesThe problem is: when the game starts, "SPACE BAR" is working fine and changes the game from day to night. When the game ends and I press restart, the SPACE key is not working. On the third time it works, on the fourth not and it follows that way. Every second time that I play the game, the SPACE key doesn't work.
The game initializes the player and sends him as a parameter a stage object and the player listens for KEY_UP.When I press restart, the game runs the init() function again.Below there are the Game.as and Player.as classes.
Code:
package
{
import com.greensock.TweenLite;[code].....
How I can simply restart an swf file from a button within that file (with actionscript 3). I'm creating a demo for the standalone player which needs a reset button which will simply reload the file.
View 7 Repliesi want to add a restart button to my little program, just want it to run again whenever i click the button "start_mc" after it's previous thread completed. i put the following lines in the beginning of code.
start_mc.addEventListener(MouseEvent.CLICK, startRestart);
function startRestart(event:MouseEvent):void
{
gotoAndPlay(1);
}
unfortunately after the program run end and i click on the button, it doesn't do anything. i wonder what can go wrong with this simple button function. I have another event listener in this program for file loading, is there conflict between them? besides this restart button the program is running ok itself.
In a mini game I made, I wanted to add a simple restart level button. All goes well during the first run of the game, but after hitting the restart button (which essentially just unpauses it by flipping a few booleans and such) the action listener to move the character in the game isn't responding. I put a trace() of a boolean switch for the action before and after hitting reset, and prior the value is correctly being displayed, but after the value is not.
I know I'm probably going to be asked to post my code, but it's quite long and unorganized, so I'm curious if there is a known issue relating to this.
In my game I would like it so once I have died you can click the 'Main Menu' button and it will take you back to the main menu and clear everything else which had been going on.
But at the moment as seen in the flash file attatched once you have died in the game a child form appears with two buttons on it 'Play Again' and 'Main Menu'. On clicking the 'Main Menu' button as you can see it takes you to the main menu but all the stuff from the previous frame are still there in the background.
In my game I am using a scrolling background with this code
if (Key.isDown(39))
{
this._x = this._x + 24;
_parent._x = _parent._x - 24;
I want to make a reset/restart button using "Enter" and it worked before.. but i realised that once you press it the background has moved so you cant see the menu screen..
I want to take a static text field, convert it into a button, and use it as a button. I need it static, because I changed orientation, and I do not know how to do that otherwise. The problem is, even though I converted it to a Button symbol, it does not work when I test the movie. It works fine with "Enable simple buttons", but when I test it, the button is not there, no change in mouse cursor, no reaction at all.So this is what I did:
Made text. // static, not selectable, Orientation: vertical left to right, / //rotated; Two filters: Drop Shadow and Glow;
Converted text field to Button - Symbol (scrollBT)
Editing the Button,I put the same content (the static text field) in all four frames: No luck, not working. without the Hit frame filled (which I think doesn't really make a difference): No luck, not working.Tried again, converting the static text field in the button into a Graphic Symbol: No luck, not working.Tried again, and put some differences in the frames for "ON" and "OVER" etc.: No luck, not working.Tried again, duplicating a similar, working button, edited it, and: No luck, not working.
To the button itself and the AS: The button will be a scroll-button for a text field, with different scroll speeds on rollover and press, but nothing else. The code for that I have (I think). It's something like (and please excuse my incorrect syntax here, but I'm typing from memory; still, I use the Script-Assistant and my syntax is apparently correct; it's also working with other buttons):
on {rollOver} {
function (scroll) {
textfieldtxt.scroll - = 1;}[code]....
I'm at the end of my wits. The only difference I can tell from other (working) buttons I did the same way, is that the scrollBt does not do anything except scrolling, while all of the others have frame actions (gotoAndplay etc.) associated with them.
[URL]
The ad on the bottom right of the screen (the one with lightning flashing) has an invisible button in its Flash file (CS5) linking to [URL]. This file is imported as SWF in Dreamweaver CS5.
The hyperlink works in Firefox, but not in Safari. Maybe it is just my computer.
I am having a problem where my buttons on main timeline are working fine. When I create a button within a movieclip layer (a page importeded from Photoshop as a movieclip) the button is not working once I leave. It doesn't show as a working button when I select Enable simple buttons, when I preview or publish as HTML. The thing is, it is a button, it has an instance name, is that weird blue color... and it works fine when I am double clicked into that movieclip layer. I also tried common library buttons and they work fine until I leave that layer as well, also tried it within other layers and creating a new file and doing it... all no success!
View 5 RepliesI made an animation. When it gets to the end I need a button script that will replay the movie. I tried:
on(release) {
_root.gotoAndPlay(1);
}
But this script only restarts the main time line. I have nested movieclips that don't get restarted. Is there a simple solution to this?
I have a flash file with the script and animation all on frame 1 of the timeline. After the script finishes I have a button appear that says "try again". I just can't figure out how to get the flash to restart or replay as if it were being played for the first time since everything is on 1 frame (which I'd liek to keep it that way if it is possible). Is there an event that will do this?
View 3 Repliesi am using this code for my timer
_root.onEnterFrame = function() {
time = Math.round(getTimer()/1000);
if (time == 120) {
[code]....
How to restart swf file, which has one frame and all staff in actionscript code? Loading copy at the end multiplies memory usage until it crash.
View 4 RepliesThis code is part of an animation where the audio is set to "Stream" in AS2. When I change the audio file to an Event, the pause and play button don't stop the audio, but the animation still "stopAllClips". When it's set to stream, there's the infamous gap in the playback when it loops.
I've been struggling to figure out a smooth and efficient way to code this animation as an Event so it loops smoothly and can pause and restart all the layers in the same place.[code]...
My movie consists of 2 frames. the menu and the actual game. The actual game is a simple platformer. I recently added a button that makes the game "gotoAndStop(1)" back at the menu. but when I proceed to play the game again from the menu. my speed is doubled.
View 1 RepliesI have rather large project that contains several swfs flvs with audio. The project is published in Captivate (which renders a main swf file). After the preloader screen, a lot of the audio files start playing at once at the beginning of the presentation. I have tried inserting an swf with AS2.0 command "stopAllSounds". It works as intended and stops all the cacophony. But then, none of my audio plays throughout the 7 minute project. Does anyone know how I can restart the audio?
View 1 Replieshow to pause the timer and restart that
View 2 RepliesI've built a pause and replay function into a children's book for a client. Since the narration is in song, I needed to keep the sound file in one piece, so I built a reverse pyramid with regular buttons throughout, truncated from the beginning with each progressive scene. So if you press the pause button at point 1 2 or 3, you are sent with a stop command to the first frame of scene 1 2 or 3, and then there's a "play" button on that first frame with this simple command[code]...
View 4 RepliesHow do I restart FMS under unix? I tried./fmsmgr server restartbut it returnsServer:restart command:Server service restart not found. Exiting.
If i type ./fmsmgr server
it returns
Server:fms command:NPTL 2.5Usage: ./server {start|stop|restart}
[code]......
trying to restart the following,
import com.greensock.*;
import com.greensock.easing.*;
var timeline:TimelineLite = new TimelineLite();[code].....
I have tried to Google this but all results are for resetting variables, fields and other code-related things. I am trying to find an answer via the animation part of Flash for this question: How can I restart my animation? (well, the file anyway.) I mean, pretty much like closing+opening the file again, you know.
Secondly, since I am new to ActionScript why isn't this code working?
var has_pressed:Boolean;
has_pressed = false;
Button1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void {
has_pressed = true;
} if(has_pressed == false) {
stop();
}
The stop(); part of it works fine! But even when I click on Button1, it still stops the animation , or at least it isn't working. That code is supposed to basically stop the animation until the button is pressed. I guess there might be another way to do it, but it practically is a 'play' button.
I am creting an application that containts 3 seperate slideshows inside movie clips, when one slideshow finishes the other starts. I do this by triggering the function inside the other movieclip slideshow ( _root.slideshow2.startSlideshow(); ) and stopping the currently running function startSlideshow = null; inside existing slide. It works until it gets to the 3rd slideshow and than everything freezes because all the functions where deleted
View 2 RepliesI'm trying to restart my flash piece with a restart button.I use gotoAndPlay(0), but nothing happens.I'm sure the click event handler is being called because I used a trace statement to verify.
rs.addEventListener(MouseEvent.CLICK, restart);
function restart(event:MouseEvent):void {
gotoAndPlay(0);
}
I have created a function to plot a number of points (values retrieved from dynamic XML and stored into an array). Every minute the function is called.Although I have hardcoded the x value of the plot, the plot data is not refreshed but added to the current existing plot. I have used the addChild and removeChild but it doesn't change at all.
Here is an extract of the code :
ActionScript Code:
private function drawCoordinate():void {
clearing();
removeChild (drawCoordArea);
[code]....
I have a a movie which is a training...I have audio along with slide that change as the veiwer watches. I have created pause buttons for the audio and will be adding in stop features to the movie itself stop however my problem is. When I pause the audio and then go to restart the audio does not restart at the place it paused. It is ramndom in its restart. Like if the phrase was "see you in september" and I pause in the middle of "september" it will not restart in the middle of september...might start at "see" might start and "in" I do not get it. Here is my script which is in the first frame.[code]...
View 1 RepliesWell I have this website where I have put background music at the beginning, of course the music can be off and on, but when I come to main page again it starts playing. How to make it so that once I off it, it will stay off till I on it again? My file is at
View 2 RepliesI have a movie with multiple movie clips each one with its own animations. There's a button that stops all animations (it works) and i want to make the same button start again the animations from same positions.. but it isnt working. I have this code to stop:
[Code]...
I'm trying to load an FLV that will start playing muted, but on click of the unmute button will restart from the beginning, with sound, I've got it working except that I can not seem to get it to restart... can anyone tell me what it is I am doing wrong here? I've been fighting with this for two days now! [URL]
View 1 RepliesI want to make a button (text saying "back to menu") make it so that when you click it, it restarts the animation. I tried but it gives me this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.at navysealstest_fla::MainTimeline/frame1() This is the code I used to get that error:
Code:
menu_mc.menu_btn.addEventListener(MouseEvent.CLICK, launchAnimationAgain);
function launchAnimationAgain(event:MouseEvent):void {
MovieClip(root).gotoAndPlay(1);
}