ActionScript 2.0 :: Stopping And Starting With A Button?
Nov 5, 2003
I have placed an invisible button over the tweened animation, now here's my question:Whe i click on the invisible button the animation stops and when I click on it again, it restartsSo that's it really, can this be done? I know how to stop the animation by putting a stop in the action script, so I am looking for some actionscript that works on an alternative click method if I am making myself clear? Example:
View 2 Replies
Similar Posts:
Aug 17, 2010
I want to play my songs in my Flash site..
I tried Making the song title as a button, and then I figured out how to make the song play by releasing the mouse button. This works great, however, when I click on the button numerous times, the song starts playing numerous times..
What I would like is to be able to click on my Song_btn once to start the song, and then click again on the Song.btn to stop the song.
or another option is to start the song with the Song_btn, and then some way to just let that song play through.
I have used the "stop all sounds" command when you navigate away from that songs particular page..
View 9 Replies
Nov 5, 2003
I have a simple tween that runs over 50 frames, there is no stop action so it loops, just what I want. I have placed an invisible button over the tweened animation, now here's my question: When I click on the invisible button the animation stops and when I click on it again, it restarts. So that's it really, can this be done? I know how to stop the animation by putting a stop in the action script, so I am looking for some actionscript that works on an alternative click method if I am making myself clear?
Example: First click stops it, second click starts it, third click stops it fourth click starts it - this goes on forever.
View 2 Replies
Jan 7, 2012
I am making a character walk. This code will make him wobble to the right and when thats done it will trigger him to wobble to the left and then call the function again to continue the loop.I can get the loop to work fine by calling the function but how do I STOP the function? Also I want to call it later on. Is there a way to start and stop a function?
function wobble()
{
var ws = .1;
var dis = 1;
[code]....
View 2 Replies
Aug 5, 2009
I can't seem to get around my video and audio files starting when I arrive at the page. I'm even using some example code with start and stop buttons. This is in CS4 Flash. I expect it's because the ActionScript is in the wrong place because when I run the movie it flashes through all of the pages on the site without stopping at the home page. Is there some generic code that will allow me to simply swap out the name of the video or audio file I want to start. If there is, do I need to locate it on its own layer at the top of the timeline?
View 6 Replies
Oct 2, 2007
I've set a music sound to play across three scenes in my movie. However, when the user clicks to enter the fourth scene, I'd like the music to stop. Simple enough.
Here's the problem...the fourth scene contains individual keyframes in the scene where I have separate voice overs for each frame. The user navs forward or backward among the scene's keyframes using arrow buttons for forward and backward. How can I have the voice over stop playing on frame 1 if the user clicks the arrow to go to frame 2 if the frame 1 sound isn't finished playing? Frame 1 plays out until finished, even if the user has clicked to go to frame 2.
Then, on return to the main scene where the general music file played, I'd like it to resume playing upon the user clicking 'return home.'
Incidentally, I set up my sound files to play on a soundtrack timeline.
View 4 Replies
Nov 23, 2010
I'm working on an assignment for a Flash Game Programming class (1 of 2) where I have to take a pre-made animation, add start and stop buttons to it, and use AS3 to make those buttons work. I got the buttons on the .fla, but I'm having a heck of a time stopping the animation using the stop button (I haven't even done the start button yet). This course is an independent study so I'm not being "taught" anything by the instructor. I have to find the answers myself. I've asked said instructor, my former AS instructor, and several computer lab monitors for help and we cannot get the animation to work correctly. There are compile errors that come up that really make no sense. This is my last resort in regards to this assignment!
Assign1WalkCycle
Code:
function onTimerStart(evt:TimerEvent):void
{
play();
}
[Code]......
View 1 Replies
May 14, 2009
Im using the flvplayback to put up a video in my swf. in my swf i also have several buttons. the thing i want to do is when i for example click a button i want to start playing the movie from 5 seconds in it and then stop the movie at for example 10 seconds in it. even if the video is 20 seconds long i want to be able to stop it automatically at 10 seconds in the movie. the start and stop should be controlled from the button..
i know how to start the movie at a specific time but i dont know how to stop it at a specific time.
View 2 Replies
Jan 10, 2007
I have 4 sets of 2 buttons (on and off):
Each set of buttons I want to trigger and stop a different audio file. (4 audio files in total)
I would like for the sound files to be saved within the .fla file.
I have done lots of searching but I still haven't been able to get this to work.
View 1 Replies
Feb 23, 2009
I need to create a tall background, when the user clicks on a button the background will scroll up and down to the area that the user wants to go to. ( I attach an image of how that might look like)
The background is divided in to 4 sections, the way i figure to do this, is to have each section be a different part of the timeline- and what I need to happen is as the user arrives at one of the sections or in that part of the timeline the mc's on that sections start playing and stoping once he/she leaves.
If there is a better way of doing this as well- feel free of telling me- Im use flash about once a year.
View 2 Replies
Apr 29, 2009
i just want my loop to keep playing regardless of the timeline stopping and starting. is this possible?
View 1 Replies
Jul 28, 2010
Im having trouble stopping or starting loaded swf files. I need to dynamically load the swf file but make sure it doesn�t play until the user requests it. The trouble is I wont know anything about the loading swf file (for example frame labels, if it has a 'stop' script in the first frame etc.) Ive attached a simplified version which I think illustrates the problem but the code is:
[Code]...
View 2 Replies
Jan 20, 2006
I have a nested MC that functions as a continuous slider; when you mouse right of center it slides one way and when you mouse left of center it slides the opposite direction. Right at center it stops. The problem I have is that I'm using this as a menu at the bottom of a .swf and there are other places to mouse on the page, which means that this menu is constantly in motion even when it's not being used. I want it to stop when it isn't being used, only because it's an MC I can't use the onMouseOut command to stop the clip. I tried making a button that targets the clip and stops it when you roll over the button but it doesn't work.
Here's the script I'm currently using:
onClipEvent (mouseMove) {
xcenter = 467.5;
speed = 1/25;
} onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
[Code] .....
View 3 Replies
Feb 4, 2009
I have a wheel that starts, loops, and slows to a stop, using 3 separate tweens, which is functioning pretty well. The issue I'm having is the transition between the startup tween and the looping tween:
Startup tween:
mWheelStartTween = new Tween(mcWheel, "rotation", Regular.easeIn, mcWheel.rotation, mcWheel.rotation+360, 2, true);
Looping tween:
mWheelLoopTween = new Tween(mcWheel, "rotation", None.easeNone, mcWheel.rotation, mcWheel.rotation+360, 1.5, true);
Visually, everything should be based on the duration of the looping tween. I played with the duration of the starting tween to get it close, but there's still a small jump. How can I set a target rotational velocity for the end of the startup tween, so it seamlessly blends in with the looping rotational velocity? Should I not be using a tween for this? I'd like to pass in a duration value to the looping tween to support different speeds....which would affect the startup as well.
View 0 Replies
Apr 17, 2009
I'm trying to do a little augmented reality. I'm using an action script to call a video and play it. The problem that I'm having is that the sound is starting the moment the window is open and the video plays with the marker is shown. I want the sound and video to only play when the marker is seen. I would like it to pause when the marker is removed and then resume where it left off when the marker is seen again. Here is a copy of my code if someone could look it over and tell me what I'm doing wrong. PLEASE PLEASE PLEASE just correct my mistake. I don't understand enough about coding for you to just say Netstream.pause() and netstream.resume. I don't know where to put that information in.
package { import flash.display.Sprite; import flash.events.Event; import flash.display.BitmapData; import flash.display.Loader; import flash.net.URLRequest; import flash.media.Video; import flash.net.NetConnection; import flash.net.NetStream;
[code]........
View 1 Replies
Jun 17, 2009
I have multiple movie clips on 4 labeled frames of my movie. The keyframes are as follows : People, Place, Portfolio, Possibilities
The buttons to go to each of these keyframes work, although because I have a movie (different for each keyframe) I cannot get the previous movie's audio to stop when I click to another keyframe.
Also, I cannot get the other movie to work once I am on the next page.
The movieclips are named- Btn2 -which is the movieclip that plays once clicked on the homepage. Btn3- which is the movieclip that is supposed to play once clicked (on the people page).
To see what I'm talking about- visit: [URL]
give it some time to load- then click the doorbell- let the movie play for a little bit then click on people...the door closes, but the sound continues.
Here's the actionscript.
ActionScript Code:
stop();
import flash.events.MouseEvent;
//---people button timeline change---//
[Code].....
View 1 Replies
Dec 22, 2009
I have done an animation which includes a button that I want to use to start it. I've added action script to stop the animation on the last frame, I just have no idea what action script to put in to start it when the button is pressed. I have 14 layers + an action script layer. 7 of the layers are animated.
View 3 Replies
Feb 17, 2009
I am just about to give up on this whole as3 thing altogether. It is so complex that it is becoming prohibitive for designers, event technical ones ike me (I program easily in perl/php/javascript/sql). All I am trying to do start the main timeline from a button. The button's "up" state is also a movie clip.
Here's the process I am looking for:
1) the main timeline progresses until a certain point where I have inserted a stop();
2) I then display a "continue" button (which is an animated movie clip).
3) the user will "click" the button and the main timeline continues.
My simple Code:
this.stop();
function closeIt(event:MouseEvent):void
{
[code]....
My problem: when the button is clicked it just starts the button over again.
View 5 Replies
Sep 6, 2009
I have a flash movie with some buttons created through action script. Currently the button links are going inside the flash menu, starting an animation. I need them to go to web folder, but I don't know how to do it.
This is the part for the button action :
fm.flashmo_button.onRelease = function(){
_root.page = this._parent.item_no + 1;
_root.play();
};
It creates 8 buttons. I tried this:
fm.flashmo_button.onRelease = function(){
getURL ("[URL]", "_self");
getURL ("[URL]", "_self");
};
When I do this, publish and click on any button, it opens both links. How can I assign for each button, a link? Here's the whole code for the button generation and linking :
stop();
import mx.transitions.Tween;
import mx.transitions.easing.*;
flashmo_logo._visible = false;
flashmo_logo._y = 300;
menu_item_group.menu_item._visible = false;
[Code] .....
View 5 Replies
Jun 29, 2009
i've given the variable as "countdown" When i press a button, i want to start count down 60 seconds, and when they passed go to the other frame (frame 2) and show my statistics.
View 4 Replies
May 21, 2010
I'm having a little trouble but I think the solution is simple. I have a button in a movie trying to start another movie rooted in scene1. I have some code placed in movie 1 to try and play movie 2, both movies are in a scene1 layer.
[Code]...
View 3 Replies
May 26, 2011
I have three buttons, which starts three separate videos...click on button starts video, that's ok, but then video is not over, if to click again,it's not starts video from beginning. I'm talking about one video. I must push on other button and then on that again to start it from beginning.
ActionScript Code:
import flash.events.MouseEvent;
import fl.video.FLVPlayback;
vidPlayer.stop();
Object(this).1btn.addEventListener(MouseEvent.CLICK, button1);
function button1 (e:MouseEvent):void{
[Code] .....
View 0 Replies
Apr 4, 2010
Is it possible to stop a sound playing without a button? I have background music on frame 1 but before I move onto frame 2 I want the sound to stop. I have 5 buttons on frame 1 to lead to different frames but I do not want them to control the sound. I also do not want to use stop all sounds on the next frame as I want sounds to work on those pages. The script below is to start the sound so how do I stop it from continuing onto the next frames when the control buttons are clicked.
View 6 Replies
Feb 28, 2012
I'm trying to stop my flash animation at a certain frame (allowing the person to click a button to go to another page).When I instert the stop code on a keyframe on my actions layer at the specified frame I want it to stop at it simply keeps looping my movie. The second problem I'm having is making my menu bar like you would see and use on a website.You click the Home button and it goes to the home page.
View 9 Replies
Sep 30, 2009
I'm trying to create a simple 'drum machine' game, where certain keys trigger sounds. I have that part down, but now I am trying to add different 'kits'. I was attempting to do this by simply creating a button to advance to a different frame on my timeline, with different actionscript that calls the new sounds in.
This is my simple AS to play a sound.
Code:
//KICK
var sndKick1:Kick1 = new Kick1();
stage.focus = this;
[Code]....
The problem I'm having though, is that when I hit the button to advance to a new frame, with different AS, the previous functions are still active, and the sounds overlap. So I need my button to somehow stop the function (seen above) and gotoAndPlay the next.
View 4 Replies
Jan 26, 2010
I've got an MOUSE_DOWN listener on the stage (it's a rough drawing tool thing) and I've also got a bunch of other buttons on the stage with MouseEvent.CLICKs on them. The problem is that the stage.MOUSE_DOWN still gets called when the buttons are pressed. Is there a simple way to stop that happening or do I just have to deal with having a boolean set and unset that blocks the code in the stage.MOUSE_DOWN event function?
View 3 Replies
May 3, 2010
I found this code to play sound:
myButton_btn.addEventListener(MouseEvent.CLICK, buttonIsClicked); [code]....
I got it working fine, but was wondering how to program a function for another button to stop stop playing that sound?I tried a function with snd.stop(); but that seems to be incorrect.
View 6 Replies
Dec 16, 2011
I need to stop a function, the function is started with a play button and I want it to stop by a stop button, then play then stop, etc. The changeColours function has a timer.start() at the end that triggers another function, which then restarts the changeColours function. These 2 functions keep doing this repeatedly after the play button and MouseEvent trigger the first function. I just want to be able to stop the changeColours function and then be able to start it again at any time.
ActionScript Code:
play_btn.addEventListener(MouseEvent.CLICK, playColours);
function playColours(e:MouseEvent):void {
if(!PLAYSTOP) {
changeColours();
PLAYSTOP = true;
}}
stop_btn.addEventListener(MouseEvent.CLICK, stopColours);
function stopColours(e:MouseEvent) {
//changeColours() needs to stop!!
}
View 6 Replies
Oct 18, 2009
I want to tear my hair out and cry! I've just upgraded to CS4 and am trying to create a simple swf that consists of a root timeline with various frames, each labelled 'home', 'bio' & 'contact'. There are buttons on the stage with instance names and then on the first frame of my root timeline I have the following code (as well as the _root.stop() as actionscript on the labelled frames):
Code:
_root.stop()
homebtn.onRelease = function():Void {
[code].....
View 2 Replies
May 16, 2010
I am putting together a basic video portfolio and have everything working except when I click the back button to get back to the thumbnail page (contained on frame 1) the audio from the video continues to play.[code]
View 4 Replies