ActionScript 3.0 :: Stopping Function Started With Play Button

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


Similar Posts:


ActionScript 2.0 :: MovieClip Used As A Button - Stop All The Other Functions From Playing Once The .onRelease Function Has Started?

May 12, 2005

My problem is pretty simple, but I'm still finding my way around even the simplest things in Actionscript. I have a movieclip named 'leaf9' in which I'm using as a button (which happens to be within another movieclip). I have the following actionscript on the frame which contains 'leaf9':

[Code]...

What I want is for all the other functions to go away once "shrink" has started to play, so that if the mouse goes over the button again, the clip doesn't start playing "rollover" etc etc. So how do I stop all the other functions from playing once the .onRelease function has started?

View 8 Replies

Flash - Calling The Function Within That Function And Later Stopping The Loop - Starting And Stopping Functions?

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

ActionScript 3.0 :: Stopping A Function With A Button?

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

ActionScript 2.0 :: Make A Button Rotate Or A Movieclip Play OnRollOver Without Stopping Or Changing Background Movie

Dec 4, 2009

How do I make a button rotate or a movieclip play onRollOver without stopping or changing background movie

View 1 Replies

IF Condition To See If A Function Or Tween Has Started?

Jul 8, 2009

I have a movie clip which is brought on to the stage by a tween function called introTween. After the introTween has finished, it has an eventhandler inside it which calls on 2 new tween functions to start. These are tweenX function which contains the myTweenX tween and tweenY function which contains the myTweenY tween. these functions loop round to keep the movie clip floating along the bottom of the stage. The movie clip can be dragged by the user. The problem I have is that when the user drags the movie clip during the introTween the dragIt function is called (see below) and when called its looking to stop the myTweenX and myTweenY tweens. However, because the introTween function hasn't finished, and thus hasn't called the tweenX and tweenY functions...then the dragIt function can't find myTweenX and myTweenY to stop(). how I would go about solving this problem? Is there some sort of IF condition I can put in the dragIt function which looks at whether the tweenX and tweenY functions have started or even the myTweenX and myTweenY tweens have started?

[Code]....

View 1 Replies

ActionScript 3.0 :: IF Condition To See If A Function Or Tween Has Started?

Jul 8, 2009

I have a movie clip which is brought on to the stage by a tween function called introTween. After the introTween has finished, it has an eventhandler inside it which calls on 2 new tween functions to start. These are tweenX function which contains the myTweenX tween and tweenY function which contains the myTweenY tween. these functions loop round to keep the movie clip floating along the bottom of the stage. The movie clip can be dragged by the user.

The problem I have is that when the user drags the movie clip during the introTween the dragIt function is called (see below) and when called its looking to stop the myTweenX and myTweenY tweens. However, because the introTween function hasn't finished, and thus hasn't called the tweenX and tweenY functions...then the dragIt function can't find myTweenX and myTweenY to stop().

Any ideas how I would go about solving this problem? Is there some sort of IF condition I can put in the dragIt function which looks at whether the tweenX and tweenY functions have started or even the myTweenX and myTweenY tweens have started?

ActionScript Code:
private function dragIt(event:MouseEvent):void {
this.startDrag();
this.parent.setChildIndex(this, this.parent.numChildren-1);

[code]....

View 3 Replies

ActionScript 2.0 :: MovieClip - Stop All The Other Functions From Playing Once The .onRelease Function Has Started?

May 12, 2005

I'm still finding my way around even the simplest things in Actionscript. I have a movieclip named 'leaf9' in which I'm using as a button (which happens to be within another movieclip). I have the following actionscript on the frame which contains 'leaf9':

[AS]
leaf9.onRollOver = function(){
this.gotoAndPlay("rollover");[code].....

What I want is for all the other functions to go away once "shrink" has started to play, so that if the mouse goes over the button again, the clip doesn't start playing "rollover" etc etc. So how do I stop all the other functions from playing once the .onRelease function has started?

View 8 Replies

ActionScript 3.0 :: Make That Function Play When A Button Is Pressed?

Jan 4, 2009

I have a very basic question. I have a custom class called caurina. I've imported the class and it works great. What i did is use that as a function called slide().

What I would like to do is make that function play when a button is pressed. I can't seem to find out how to do this anywhere. I am using as3.

Summary: When btn is pressed go play function slide()

View 6 Replies

ActionScript 3.0 :: Sorting Out The Play/pause Function On The Button?

Nov 9, 2011

I have this fla file... 40 frames to be exact, each frame is a movie clip with AS3 code for a fade transition. I implemented to auto play with delay of 10 seconds on each frame, then next frame and so on. I also have implemented the next and prev button (next frame, prev Frame) and the arrow keys on keyboard function.
 
Now I need help on sorting out the play/pause function on the button (play>pause button) I did a code, it pause on the the frame when i click pause, but the as code on the mc clip on the frame proceeds and when i press the play button, it plays at current frame, but plays fast straight to the last frame.

[Code]...

View 7 Replies

ActionScript 2.0 :: Get A Play/stop Function To Work In One Button?

Apr 15, 2009

I am trying to get a play/stop function to work in one button. I know how to stop the play head and start it again with two separate buttons but can't do it with one button that toggles between the two states.

View 5 Replies

ActionScript 2.0 :: How To Play And Stopping Mp3(music)

Oct 9, 2007

in my game there are two labels, the "menu" label and the "game" label.i want to have one mp3(song) playing during the "menu" label and another (song) playing during the "game". So,while the player is in the "menu", if he clicks the "play" button the mp3(of the menu) must stop and the mp3(of the game) must begin.i have tried putting the command "stop all sounds" in "play" button's function, but it doesn't only stop the music that was being played (menu's mp3) but also the music that follows (game's mp3)

View 2 Replies

Actionscript 2.0 :: Stopping Auto-play For Non XML Video Player?

Dec 3, 2007

i made a player based on the 'Video Basics' series and would like to disable the auto play. I've only found posts dealing with stopping auto play in the XML version and I can't figure it out.

I assume that I must modify the early part of the script?

Code: Select allvar nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(10);

[Code].....

View 9 Replies

ActionScript 3.0 :: Play Few Frames Of A Movie In Reverse But Stopping At Set Points

Feb 11, 2010

I'm very new to flash and even though i'm capable of using the search function and finding posts which look relevant i don't really understand them, most notably i am only familiar with controlling a movie clip with buttons within the movie clip symbol and i get confused by actionscript that seems to do otherwise.

Within a frame on my main stage i have a movie clip symbol of around 125 frames. To control this movie clip symbol i have 4 button symbols within the movie clip symbol. The actionscript code that runs throughout this movie looks like this[code]...

This leads to free frame by frame navigation using the buttons forward_btn and backward_btn and if you'd like to move to set points in the animation you can use the fastforward_btn which plays the movie clip forwards until it hits a stop command on one of my chosen frames.

What i'd like to do is have a button that plays the frames backwards until it hits these frames. Is there a combination of while loops and prevFrame() i can use or anything straight forward?

View 1 Replies

ActionScript 2.0 :: Stopping Execution Of A Function?

Feb 22, 2006

how do you stop the execution of a function?

View 6 Replies

ActionScript 2.0 :: Stopping A Function Loop?

Feb 23, 2011

well its not really a loop in the strict programatic sense, but the effect is similar. I have a function attached to a button that uses the onEnterFrame event of an MC to start some action. When I rollout I want the action to stop, similar to using a clearInterval method. I tried using the setInterval method to create the action but the values inside the interval function are only checked at the first call of the setInterval, not after each interval.I'll admit I am far from a programer or any kind of expert in code, so my methodology may be completely whack. I am open to suggestions to better solutions...FYI, here is the code I am using

scrollRight_btn.onRollOver = function(){
thumbScroll(+5);
}

[code].....

View 1 Replies

ActionScript 2.0 :: Add A Play Button, So The Gallery Would Play The Pictures OnRelease Of The Button At Interval?

Jun 23, 2006

I'm building a photogallery base on this tutorial http:[url]....I'm trying to add a play button, so the gallery would play the pictures onRelease of the button at interval of 3s.It's not working. my code is:

playBTN.onPress = function() {
this._alpha = 50;
setInterval(this, "nextImage", 3000, 1);[code]....

View 5 Replies

Actionscript 3 :: Stopping A Function To Run More Than Once In A Period Of Time

Nov 12, 2010

I have this MouseEvent function that I have totally no idea why it fired twice. Is there a way I can disable the function in a period of time? I tried disabling the button, but seems like it directly called the function and does not trigger from the button.

Addition info:When I add in more object to the array, the function fired more time

The Class the handles the button

package classes
{
import flash.display.MovieClip;

[Code]....

View 2 Replies

Actionscript 3 :: Stopping A Yoyo() Tween Within A Function?

Mar 4, 2012

I am wanting to stop this yoyo movement when a sound stops.

This is not all the code but the important parts:

I DECLARED THE VAR OUTSIDE OF THE FUNCTION:

var BB:Tween;
........
function BounceBeau()
{

[Code]....

View 2 Replies

ActionScript 2.0 :: Stopping A Function From A Dynamically Loaded Mc?

Jul 22, 2003

I'm using a timer on a keyframe to auto refresh mcs every 10 secs. This is working correctly but when I click on a button from a dynamically loaded mc I want it to stop the function from running.

[AS]
function movieDelay() {
choice = Math.round(Math.random()*2);
switch (choice) {

[Code].....

View 9 Replies

ActionScript 2.0 :: Stopping A _root.onMouseDown = Function()?

Oct 7, 2003

i have a:

Code:
_root.onMouseDown = function(){
someAction

[code].....

View 4 Replies

ActionScript 3.0 :: Tween Function Stopping In Middle Randomly

Sep 19, 2010

I have a game where the player movement is dynamic but have the same template, so the movement is performed by a Tween() with changing variables. next I create a listener for the "TweenEvent.MOTION_FINISH" event of that tween, the purpose for that listener is because when the movement animation ends I call a function to show the player his next movement options.

here's the thing: in some cases, randomly, when the player performs a move the tween just stops suddenly, this is problematic for two reasons: first the player character stops in the middle of a movement, secondly the "TweenEvent.MOTION_FINISH" event is not thrown and the function that show the player his next movement options is not called.

View 3 Replies

ActionScript 2.0 :: Stopping Function Calls In Game Project?

Mar 5, 2010

I am developing a game project, in which I have many functions on it. I have all the major functions on the frame 50. And I don't want these functions on the next frame. Indeed I didn't have these functions on the 51st frame, the 51st frame only contains a stop action. But flash calls all the major function on the 51st frame also, I don't want these function to call on the 51st frame. Is there any way to stop this? Or else my program contains error?

Here is the program...
= The 50th Frame =
stop();
fscommand("allowscale",false);
fscommand("fullscreen",false);
var die:Boolean = false;
var currGun:String="hd_gun";
[Code] .....

View 3 Replies

ActionScript 3.0 :: Stopping Sound Without A Button?

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

Professional :: Stopping At Frame & Button?

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

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

ActionScript 2.0 :: Starting And Stopping Sounds With One Button

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

ActionScript 2.0 :: Tween - Stopping And Starting With Button?

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

ActionScript 3.0 :: Stopping Stage.MOUSE_DOWN When Other Button Is Clicked?

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

Professional :: Stopping Sound Playing On Button Click?

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







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