[F8] Stopping Actions After A Frame Is Reached On A Movie Clip
Me again. This time what I'm tyring to do is to prevent an action from happening once a certain frame within the movieclip is reached. For example:
When the movieclip button is moused over, the size/alpha of the movieclip changes, for 4 times, up to 100%. Then after this I want to disable the function from being able to run. The code currently running is:
kick1.onRollOver = function() { tellTarget (kick1) { this.nextFrame() } };
So when the clip reaches frame 11, I want to stop the user from being able to use the function above. Do I need an if statement? i.e:
If kick1.framenum >=11, kick1.onRollover = null?
Or does it need to be rooted/have a this statement in the code to function?
Cheers.
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-17-2007, 04:11 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Action When Frame In Clip Reached?
Hi,
I have 2 clips, one clip has teh following code.
temp = random(10);
if (temp>5) {
_parent.barC.nextFrame();
}
gotoAndPlay(2);
So this clip just repeats, incrementing the frame number of the child clip.
The child clip has 40 frames, so i want something like
_parent.barC.nextFrame() UNLESS _parent.barC has reached frame 40, in which case, stop, and do something else.
Is there code to pick up the location of the play handler in a clip?
Do i have to use an int counter to achieve my goal or is there a more elegant solution avaialable.
Cheerz
Dwayne
Stopping Movie Clip At Random Frame
hi,
i am loading random movie clips into 4 seperate empty movies, i now need a way to get these random clips that i am loading to play for a random amount of time and then load the next clip.
how can i do this?
thanks
Stopping Or Starting A Movie Clip At A Random Frame
hi,
i am loading random movie clips into 4 seperate empty movies, i now need a way to get these random clips that i am loading to play for a random amount of time and then load the next clip.
if i assign it a random number and get the clip to loop, then compare the number to the current frame of the movieclip and if true, tell it to stop and move to the next random clip...would this work?
i have no idea how to write the code for this
any help would be great
thanks
Please Review : How To Stop A Count When The Movie Reached A Specific Frame?
Basically, i want to stop the Distvar from ticking after i reached the last frame ( which is 151 ) or the first frame of the mc, myMC1. I tried using
if (cfrm==1 || cfrm==151) {
//stop
}
but it didn't work coz if the ymouse is still within 0-175 or 225-400, the Distvar will still continue ticking...
so any ideas? below is my script.
// Fort Canning Park Walthrough : final semster project
// user speed input
if (_root.input.text == "") {
speed = 1;
} else {
speed = _root.input.text;
//trace(speed);
}
// forward and rewind of mc
myMC1.onEnterFrame = function() {
mousePos = _root._ymouse;
cfrm = _root.myMC1._currentframe;
if (mousePos>0 && mousePos<175) {
_root.myMC1.gotoAndStop(cfrm+speed/1);
} else if (mousePos>225 && mousePos<400) {
_root.myMC1.gotoAndStop(cfrm-speed);
}
};
updateAfterEvent;
// Time
timevar = Math.round((getTimer()/1000));
// Distance
function distcount() {
distvar = Math.round(getTimer()/1000*speed/3);
}
if (mousePos>0 && mousePos<175) {
distcount();
} else if (mousePos>225 && mousePos<400) {
distcount();
} else {
//stop
}
if (cfrm==1 || cfrm==151) {
//stop
}
updateAfterEvent;
the bold part in the script denotes bug which i'm not sure how to fix. Please help, thanx in advance i own you.
Load Clip Before Frame Actions
Dear Colleagues,
In one frame I have 8 clips. On the frame itself I am calling a function inside the clips. The problem (I believe) is that the frame actions are called before the clip is loaded. How do I verify that the clips are loaded before the frame action is called?
Change Direction Of Movie Clip/stopping Moving Clip
Hello everyone,
I cannot wrap my brain around this anymore. It's been sometime since I have done much actionscript but here it is:
Functionality:
I have the movie clip moving from left to right and once it reaches a certain point, it changes direction and goes back, infinitely.
I have a hitTest to check weather the mouse is over the target movie clip, if it is, the movement stops.
Problem1 - Movement:
When I mouseover the target movie clip it stops (hitTest=true) but the movement does not resume when the hitTest is false.
Here's the code:
var xchange=10;
holder_mc.onEnterFrame = function() {
//trace("x_pos: "+this._x)
//trace("xchange: "+xchange)
this._x += xchange;
if (this.hitTest(_xmouse, _ymouse, true)) {
xchange=0;
this._x += xchange;
}
else{
if(this._x > 0){
xchange=10;
xchange*= -1;
}
else if(this._x < -645){
xchange *= -1;
}
}
}//--------------------------------------
Problem 2 - CPU Resources
Also I have code on the individual movie clips within the target movie clip, they simply play frames forward and backward to enlarge a thumbnail. After a while the computer starts hating life and chugs. I know it is from the hitTest checking on each enterFrame and it eats up the resources. Is there a way to do this without the chug?
Here is the code that expands the thumbnails within the target movie clip:
stop();
this.onEnterFrame = function() {
if (rewind == true) {
prevFrame();
}
};
this.onRollOver = function() {
this.swapDepths(this.getNextHighestDepth());
rewind = false;
play();
};
this.onRollOut = function() {
rewind = true;
};
//----------------------
If someone could give me any insight into this problem I would greatly appreciate it.
Thanks guys,
I hope I've been clear.
Load Mc When Reached Frame ...
When my scene plays it stops at say frame 100 for example.
after frame 100 there is also an animation.
when i load my mc by pushing the button on the scene it should firstplay the animation say for exemple from 101 to 130.then show the mc. Is there a actionscript for this or should I have to place 30 empty frames in the start of my mc.
When MC1 Reached Frame 40, Play MC2
I have a button on my main timeline and two Movie clips, MC1 and MC2.
When you click on the button, it performs this check:-
on (release) {
if (MC1._currentframe==25) {
MC1.gotoAndPlay("26");
}
}
This is working fine.
I am trying to script the button to do this:-
If MC1 is on frame 25, tell MC1 to play frame 26 (Done this above already)
When MC1 reaches frame 40, tell MC2 to start playing.
How can I script this? There is no WHEN script.
If Reached A Certain Frame - Stop
Hi, can you, please help me with this. I have a button, it functions like this
on (release) {
nextFrame();
I want this action stop at a certain frame. So nothing happens when you click a button when it reached a certain frame.
Thank you.
If Reached A Certain Frame - Stop
Hi, can you, please help me with this. I have a button, it functions like this
on (release) {
nextFrame();
I want this action stop at a certain frame. So nothing happens when you click a button when it reached a certain frame.
Thank you.
Mc To Play Until A Certain Frame Is Reached, Then Stop
Hi, I'm hoping someone can help!
I have an mc placed on the main stage that I'm trying to control through a separate button. I want the mc to play until a certain frame number is reached and then stop. I've got the following actionscript on the button instance:
Code:
on(rollOver){
if (mc._currentframe == 10){
mc.stop()
}
else{
mc.play()
}
}
This is not working at all - the mc is not stopping at frame 10, just looping continuously - am I missing something?
Thanks for any help!
[F8] Can You Tell When A Loaded SWF Has Reached Its Final Frame?
I used loadMovie to load an external SWF into the bottom-half of a main "shell" swf. When that loaded SWF finishes playing (it's just an animation), I need to populate a text field with the word "DONE" . The text field resides on the _root, so I need some way to know when the loaded SWF has reached its last frame...
This would obviously be easy if I had the .FLA of the loaded SWF because I could just write the actionscript on the last frame of that SWF to populate the _root textfield. Alas, I do not have the source FLA of that loaded SWF, so I need some way to have the main "shell" SWF/FLA know when that loaded SWF has reached its end. Is this possible???
Thanks!!!
Can You Tell When A Loaded SWF Has Reached Its Final Frame?
I used loadMovie to load an external SWF into the bottom-half of a main "shell" swf. When that loaded SWF finishes playing (it's just an animation), I need to populate a text field with the word "DONE" . The text field resides on the _root, so I need some way to know when the loaded SWF has reached its last frame...
This would obviously be easy if I had the .FLA of the loaded SWF because I could just write the actionscript on the last frame of that SWF to populate the _root textfield. Alas, I do not have the source FLA of that loaded SWF, so I need some way to have the main "shell" SWF/FLA know when that loaded SWF has reached its end. Is this possible???
Thanks!!!
DEADLINE 5 HOURS When MC1 Reached Frame 40, Play MC2
I have a button on my main timeline and two Movie clips, MC1 and MC2.
When you click on the button, it performs this check:-
on (release) {
if (MC1._currentframe==25) {
MC1.gotoAndPlay("26");
}
}
This is working fine.
I am trying to script the button to do this:-
If MC1 is on frame 25, tell MC1 to play frame 26 (Done this above already)
When MC1 reaches frame 40, tell MC2 to start playing.
I can't add a script at frame 40 in MC1 to tell MC2 to play, and I only want MC2 to play when the button
on the timeline is pressed
Any ideas?
How To Execute An Action From A Button After A Certain Frame Has Been Reached
I am trying to do something relatively simple but I cannot determine the best method. I have a navigation menu which drops down from the top of the site, and when one of the options is selected it is supposed to raise back up off the screen and then load the selected page.
Basically, I have something like this for each button:
on (release){
this.gotoAndPlay("raisebuttons");
getURL("page.html");
}
Obviously page.html is different for each button. Raisebuttons is a labeled frame which brings the buttons off the screen. My problem is that I need the getURL to wait until the final frame of "raisebuttons" is reached. Right now the getURL happens too quickly and the buttons do not make it off the top of the screen quickly enough. Can anyone offer any advice?
[F8] Play An Mc Until A Frame Label Is Reached, Then Stop
Hi all,
I have a movieclip placed on my main timeline which I'd like to be able to control from buttons on the main timeline. The movieclip has several frame labels that I'd like to be able to go to directly. I can do this with the following code:
Code:
on (release) {
mc.gotoAndStop("b");
}
However, I'd like to be able to tell the mc to play from the beginning until it reaches a certain frame label, and then stop. Something like this:
Code:
on (release) {
if (mc._currentframe="b") {
stop();
} else {
play();
}
I don't think the syntax is correct which is why it's not working. Can anyone help me out with this?!
Any help would be greatly appreciated, thanks!
[F8] Play An Mc Until A Frame Label Is Reached, Then Stop
Hi all,
I have a movieclip placed on my main timeline which I'd like to be able to control from buttons on the main timeline. The movieclip has several frame labels that I'd like to be able to go to directly. I can do this with the following actionscript:
Code:
on (release) {
mc.gotoAndStop("b");
}
However, I'd like to be able to tell the mc to play from the beginning until it reaches a certain frame label, and then stop. Something like this:
Code:
on (release) {
if (mc._currentframe="b") {
stop();
} else {
play();
}
I don't think the syntax is correct which is why it's not working. Can anyone help me out with this?!
Any help would be greatly appreciated, thanks!
Stopping Movie At Variable Frame
Hi -
I have a movie that is 50 frames long. I would like to have the movie
play a number of frames and then stop at a designated frame, which is
dictated by whatever I set the variable to. For instance, if I set x
= 5, I want the movie to play from the beginning and stop on the 5th
frame.
Any assistance would be greatly appreciated.
Stopping Movie Clips Per Frame
I have a question...
Lets say I had a movie clip with six frames and wanted to make each frame number display the image of that current frame. For example, if frame one was a picture of a cow and frame two was a picture of a cat, how can i have a row be visible where the first movie clip was the cow, then the second one next to it would be the cat?
A loop is needed for this, but when I try to do it, instead of getting a different picture per frame going horizontally in rows, they go vertically in columns. Also, after it shows the first 6 images of the movie clip, it repeats the last frame of the movie clip for the remainder of the rows and columns.
Since the frame number would never be greater than 6, I know an IF statement is needed, but it just isn't working. I probably didn't place it correctly in the loop. Please help
Triggering From Movie Stopping On Frame
I'm a newbie to ActionScript and am sure this is a simple thing that I'm just approaching in the wrong way. I have movie (A) that I trigger with a gotoAndPlay command from a button press. When A gets to a certain frame is stops on a stop();. At this point I want to trigger Movie B to begin. I've tried using a while statement based on watching the _currentframe of A, but it just locks up. How can I monitor what A is doing without pulling all the processor time?
Thanks
A Button Action To Trigger A Command When A Frame Is Reached
I have a button that I want to launch a pop up window but I want it to play the timeline up to a certain frame before launching the window. I cannot put the action directly on the timeline as another button needs to play through that same timeline.
Something like: On release play the timeline then stop at that labeled frame and launch the pop up window.
What's the best way to do this from a button action?
Thanks!
Loading A Clip After Another Has Reached A Position
I have a movie clip being loaded for my effect and backdrop for all menu items. The ending postion I have labeled "end".
so on the press function on each button what is the code I need so that each button loads the backdrop then in a holder clip loads each diff swf of content.
example of button code..
on (press) {
//first changes the menu title area
_root.menu_names.gotoAndPlay("about");
//this is the pop up backdrop
_root.pop_mc.gotoAndPlay("run");
//now I need the script to call up each buttons content
if (_root.pop_mc == frame("end")){
_root.popUp.holder.loadMovie("KM_about.swf");
}
}
Making A Movie Load And Stopping On One Frame
ok, I have an intro movie that plays and then ends on a menu that goes to three other movies. Now at the end of those movies I have a button that I want to go back to the frame with the menu in the first movie. Problem is I can't get the button at the end of the movies to go back to the menu frame. I've tried telltarget and a few other things, unfortunatly nothing's panning out... anyhelp would be greatly appreciated.
Oh yeah, the movie's name is tuteintro anf it's frame 975, should i try pointing to a label, instead? I will clarify as needed...
Thanks in advance
Stopping A Movie Clip
My movie clip consists of 1 rotating image and on the next level down there are buttons based around that image.
How can i get the movie clip to stop rotating when i roll over the buttons that are 1 level beneath?
Thank you
Stopping A Movie Clip
here's the scene...i want a movie clip to play just once...presently the first scene in my movie is only the length of one loop (time wise)...so i have an action set on the last frame to goto and play the next scene, where i have some simple animation inlcluding alpha effects..it doesn't work and it must be something i'm not doing with the movie clip i put into scene 1...hope that makes sense..cheers for any advice..still a bit new
Stopping A Movie Clip?
Ok before I ruin everything I worked on I would like to know how you make a movie clip stop like I want a guy to speak and than when he's done speaking I want his mouth to stop moving how would you do this?
Stopping A Movie Clip...
Am I missing something here? Is it not possible to add a STOP action to a movie symbol so that it plays out the animation and then stops on the last frame?
e.g.
I've done an animation of a (not fully circular) ball rolling to its side as a movie clip. I then imported this movie into the stage and added a motion tween to make the ball look like it is rolling to a stop. It's suppose to stay in that position for the duration it's visible. When I add a stop action to the movieclip's final frame it doesn't seem to have any effect, so I have resorted to converting it to a graphic and dragging out the last frame beyond the time it is visible
This just seems a little absurd, is there a better way?- or is this what everyone does...
Stopping A Movie Clip
Hi everyone!
I created a movie clip and two buttons that control it from right to left.
I am using this actionscript:
var speed = 5;
leftButton.onPress = function() {
mcName.onEnterFrame = function() {
this._x -= speed;
};
};
rightButton.onPress = function() {
mcName.onEnterFrame = function() {
this._x += speed;
};
};
rightButton.onRelease = function() {
delete mcName.onEnterFrame;
mcName.stop();
};
leftButton.onRelease = function() {
delete mcName.onEnterFrame;
mcName.stop();
};
Is there a way to stop the movie clip once it reaches a point on the X coordinate? I just don't want it to leave the stage if the buttons are pressed too much. Any suggestions?
Movie Clip Not Stopping
God, will I ever not feel like a Flash beginner?
Here I have a simple movie clip object with it's own actions layer, with a stop(); command at the end of it. This movie clip object is then placed on the main timeline - however, the movie clip does not stop. Crazy! Any ideas? I am simply putting the movieclip on the main timeline manually, i.e. dragging it there. When I play the main clip, I see my nested movieclip, but it doesn't stop. When I play the movieclip independently, it stops at the right place. Do I need to insert more frames in the main timeline so that it registers the stop on the movieclip? I thought movieclips behave independently of the main timeline?
Much thanks.
Stopping Movie Clip
Here is the problem. I am an actionscript newbie. I have a movie clip moving across the stage on the main timeline and want to stop it when it reaches a certain x value. I can't seem to get it to stop and stay still at position -700. Any help would be great!! Below is the code
Attach Code
onClipEvent (enterFrame) {
this._x += 1.5;
if (this._x == -700) {
this._x == -700;
}
}
Edited: 11/18/2008 at 10:00:32 AM by Ger75
Stopping My Movie Clip At _x = O
I have made a modified infinate menu, and I would like to make it stop at the begining and the end.
Here is the code that I have so far. What can I add to it to make it happen?
onClipEvent (load)
{
speed=-1;
}
onClipEvent (enterFrame)
{
_x+=(speed);
if (_x > 0) _x=-4603.3;
if (_x < -4603.3) _x=0;
}
Stopping A Movie Clip
Okay, a more specific question in relation to the "clockwork" thread I posted earlier...
In my animation I have a movie clip that is constantly spinning, but is it possible to make a button stop the movie clip wherever the movie is at - then when the button is released, have the movie continue playing from where it stopped?
I know it's retarded, and it probably has a really simple explanation, but Flash eludes me when it becomes technical..
Your help would be MUCH appreciated...
Stopping A Movie Clip
I have made an infinite menu using the tutorial HERE, except i have replaced the contents with images and have placed into a larger flash document which will be a web page.
The problem i have is that wherever the mouse is on the page, the images keep scrolling and because the page is much larger than the example given, it scrolls extremely fast when the cursers over the other side of the page(which looks awful). Is there any action script i can use to stop the scrolling when i move the curser outside a given area?
Thanks for any help, you have an amazing site here
Nealo
Stopping My Movie Clip At _x = O
I have made a modified infinate menu, and I would like to make it stop at the begining and the end.
Here is the code that I have so far. What can I add to it to make it happen?
onClipEvent (load)
{
speed=-1;
}
onClipEvent (enterFrame)
{
_x+=(speed);
if (_x > 0) _x=-4603.3;
if (_x < -4603.3) _x=0;
}
Stopping Movie Clip
Another relative newbie with a movieclip problem....
I have a movie clip ("snow") playing on the main stage using random numbers plus other assorted math to generate falling snow effect but I'm unable to stop it, even when the movie continues to the next scene.
Ideally I'd like to stop it using an onrelease command in a different layer, or alternatively stop it when the main movie reaches the first frame of the next scene.
The problem seems to be a duplicateMovieClip command attached to the frame that the movie clip sits in.
for (k=0; k<20; k++) {
duplicateMovieClip(this.snow, "snow"+k, k);
}
Is this what's causing it to just keep going forever? If so, what command will stop it? Thanks.
Stopping Loaded Movie Clip
HI,
could anybody explain me how to control a loaded movieclip.
1) I have loaded a moviclip in a target using command
loadMovie ("images\module07\anim_01.swf", "movie");
where imagesmodule07 is directory name & anim_01.swf is loaded file, & "movie" is the target in which I have loaded the movieclip
2) Now if on click of a button I want to stop the anim_01.swf at a particular frame say _currentframe . what is the best to control it & what command should I use.
please help me. i'm stuck up
Stopping A Random Movie Clip
I have a first person shooter I'm building. I need some help on the below code.
onClipEvent (enterFrame) {
_x = random(380)+60;
}
on (press) {
this.gotoAndPlay(2);
_root.score += (10);
}
The code works great as far as the positioning of the clip. But it cuts on and off real fast. Not the desired effect. I want it to pick it's random spot stop until shot and then go somewhere else.
Suggestions
Thanks
Close Or Stopping A Movie Clip
I made movieclip inside a the main movie. I finally learned how to make a button open the movie clip but I cannot figure out how to make the button close it. I've tried several actions none seem to be right. Any help would be greatly appreciated!! Thanx W.Thompson
Having Trouble Stopping Movie Clip
I made movieclip inside a the main movie. I finally learned how to make a button open the movie clip but I cannot figure out how to make the button close it. I've tried several actions none seem to be right. Any help would be greatly appreciated!! Thanx W.Thompson
Stopping Sound In One Movie Clip Only
Hello there,
I wonder if anyone can help me doing this:
I need to stop the sound coming from one movie clip with a button inside of it. The problem is that I have a few movie clips with sound but I don't know how to stop the sound from just one movie clip as oposed to all by using stop all sounds.
Can you help me with this one?
Thanks
Daniel
Stopping Sound In One Movie Clip Only
Hello there,
I wonder if anyone can help me doing this:
I need to stop the sound coming from one movie clip with a button inside of it. The problem is that I have a few movie clips with sound but I don't know how to stop the sound from just one movie clip as oposed to all by using stop all sounds.
Can you help me with this one?
Thanks
Daniel
Stopping A Scrolling Movie Clip
I recently made a scrolling 360 panorama based on Degree's tutorial. It works just as it should, but I wanted to add a feature that would freeze the scrolling when a user clicked on a button, then unfreeze when the button was clicked again. I'm still a big actionscript newbie, any help as to how to do this would be appreciated.
Here's the project as it currently exists
EDIT: Using Flash MX Professional 2004
Stopping A Scrolling Movie Clip
I recently made a scrolling 360 panorama based on Degree's Tutorial. It works just as it should, but I wanted to add a feature that would freeze the scrolling when a user clicked on a button, then unfreeze when the button was clicked again. I'm still a big actionscript newbie, any help as to how to do this would be appreciated.
Here's the project as it currently exists
p.s.
I'm using Flash MX Professional 2004
Stopping A Scrolling Movie Clip
I recently made a scrolling 360 panorama based on Degree's Tutorial. It works just as it should, but I wanted to add a feature that would freeze the scrolling when a user clicked on a button, then unfreeze when the button was clicked again. I'm still a big actionscript newbie, any help as to how to do this would be appreciated.
Here's the project as it currently exists
p.s.
I'm using Flash MX Professional 2004
Stopping FLV In Loaded Movie Clip
Okay... I have a Shell site that I'm loading different swf Clips into depending on the button press. In this Clip is loading a streaming FLV. When I go to press another button in the Shell to load a new Clip, the FLV continues from the last Clip continues to play! How do I stop it?
thanks!
Stopping FLV In Loaded Movie Clip
Okay... I have a Shell site that I'm loading different swf Clips into depending on the button press. In this Clip is loading a streaming FLV. When I go to press another button in the Shell to load a new Clip, the FLV continues from the last Clip continues to play! How do I stop it?
thanks!
Stopping A Movie Clip When Another One Is Selected
Hi
I'm working on my portfolio and I have buttons that when clicked on start a movie clip. The action that I want is to stop the movie clip that's playing if another is selected.
I hope this makes sense.
Thanks
Actionscript In Movie Clip...stopping All?
Hi guys,
I could use some advice on this project of mine.
I have my project file where I have several buttons. The idea is to have a sound file (loop01, loop02, etc) assigned to each button. The button controls each sound file's on/off property individually (an on/off toggle). I got this from a tutorial on how to make toggle buttons, but the tutorial only addressed creating one button. I need ten. To solve this, I have made each button into it's own movie clip. Here's the info from the individual movie clips...
In frame one, I have this...
my_sound = new Sound();
my_sound.attachSound("loop01");
play();
In frame two...
stop()
In frame three...
stop()
My "on button" is on frame two with this code...
on (release) {
my_sound.start(0,700);
gotoAndStop("stop");
}
My "stop button" is on frame three with this code...
on(release) {
my_sound.stop();
gotoAndStop("play");
}
My sound file has been linked up to this as well. I have two of these buttons made so far and each plays it's loop correctly. The problem is that if I have both sounds running (on) and I click one "off", both of them stop playing. I thought movie clip timelines ran independant of the main timeline so I am bit confused why this is happenning. Thanks in advance and sorry about the long post!
Help Stopping Movie Clip Animation
I've got the button thing I was trying to do to work but now the movie clip is automatically playing when the main movie loads. It still works with the button click, which is what I want it to do. Does anyone know how to stop it from playing until you click the button?
|