Play To Frame#, Then Gotoandstop At Another Frame#
Can anyone help me with this? I need to assign a button action that on (press) tells the timeline to simply start to play, but then at a designated frame number (29), it needs to gotoandstop at frame (240).
For example:
on (press) { play(); } then at frame (29) gotoandstop(240)
Due to the way I've set up the main timeline, with some overlapping stairstepped buttons, I can't simply put the gotoandstop action in the actions layer. I need to embed this in each button, otherwise I'm looking at a major rebuild of the layout. For example, it will work like this:
Contact button - on press plays to 29, then when 29 is reached, it jumps to 240 About Us button - on press plays to 29, then when 29 is reached, it jumps to 230 News button - on press plays to 29, then when 29 is reached, it jumps to 220 etc. etc.
Any ideas?
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-11-2004, 10:19 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Play... Then... GotoAndStop Various Frame Options
I can do this by creating three seperate MC's but I'm trying to avoid that when one MC will do if I can figure this out. Here's the scenario:
I have three buttons sitting within an MC on the same frame where a STOP action sits on another layer.
When one of the buttons is clicked I want an animation to play, the same animation for all three buttons. AFTER this animation is completed, I want the playhead to gotoAndSTOP at a specific labeled frame, based on which button was clicked. All that will be displayed on this frame is the last frame of the animation and text, specific to the labeled frame.
I'm not sure how to do this. A "play" action will start the animation, but how I get the playhead to go to a specific frame after the animation is over is where I'm lost.
I'm sure there's an obvious answer, but I'm missing it.
Thanks
[F8] GotoAndStop Does Not Go To Correct Frame, According To Frame Label
I'm having trouble getting gotoAndStop to go to the correct frame. I've labeled frame 5 as "FIRST", frame 10 as "SECOND", and frame 15 as "THIRD".
Then I put the following code on frame 1, which I labeled "HOME", if it matters.
//var myFrame:String = "FIRST";
var myFrame:String = "SECOND";
//var myFrame:String = "THIRD";
trace(myFrame);
this.gotoAndStop(myFrame);
trace(this._currentframe);
stop();Letting myFrame = "SECOND" sends the playhead to frame 9, but it should be 10. When myFrame = "THIRD", the playhead stays at frame 1, while it should go to 15. Only "FIRST" goes to its correct frame, 5. Note that if I change the frame that is labeled "SECOND" from frame 10 to frame 9, then the playhead goes to frame 8.
I thought that this would be a really simple thing to do, but I'm getting quirky results.
Everything is on the root level and there are no movieclips or scenes involved.
Any help would be greatly appreciated. Thanks, guys.
[F8] GotoAndStop Does Not Go To Correct Frame, According To Frame Label
I'm having trouble getting gotoAndStop to go to the correct frame. I've labeled frame 5 as "FIRST", frame 10 as "SECOND", and frame 15 as "THIRD".
Then I put the following code on frame 1, which I labeled "HOME", if it matters.
//var myFrame:String = "FIRST";
var myFrame:String = "SECOND";
//var myFrame:String = "THIRD";
trace(myFrame);
this.gotoAndStop(myFrame);
trace(this._currentframe);
stop();Letting myFrame = "SECOND" sends the playhead to frame 9, but it should be 10. When myFrame = "THIRD", the playhead stays at frame 1, while it should go to 15. Only "FIRST" goes to its correct frame, 5. Note that if I change the frame that is labeled "SECOND" from frame 10 to frame 9, then the playhead goes to frame 8.
I thought that this would be a really simple thing to do, but I'm getting quirky results.
Everything is on the root level and there are no movieclips or scenes involved.
Any help would be greatly appreciated. Thanks, guys.
Trying To Make Movie Play Frame X To Frame Y Then Switch To Frame Z..
Hello,
I was hoping someone could help me out with an issue I'm having. I have my flash on multiple scenes, and would like to play an animation when clicking on the navigation button before switching to a different scene.
I'm halfway to accomplishing this.
Here is what i used
Code:
_root.gotoAndPlay("changepage1");
_root.onEnterFrame=function(){
if(this._currentframe=="changepage2"){
gotoAndPlay("Home2",1);
}
}
The above code is on a blank keyframe. Changepage1 is the start of the animation and Changepage2 is the end of the animation.
Upon clicking the navigation button it plays the above scenes.
However it doesn't change scenes to scene "Home2".
Thank you in advance for all your replies.
GotoAndStop(frame);? ... Won't Go To Correct Frame
i have a small flash website. each page is 10 frames apart on the timeline. the menu buttons(movieclips) are on a "global" layer spanning across the entire document. when i use the following code (placed on a global layer) for each instance of the movieclip it moves to the right frame but the movieclip animation does not play (basically the button does not spin):
ABOUT.onPress = function() {
gotoAndStop(10);
}
SERVICES.onPress = function() {
gotoAndStop(20);
}
NEWS.onPress = function() {
gotoAndStop(30);
}
CONTACT.onPress = function() {
gotoAndStop(40);
}
when i try to use (onMouseDown), the movieclip animation plays but it does not move to the correct frame... it moves to frame 10 no matter which movieclip you press and then its stuck there...
here's a snapshot of my flash gui to get a better idea of my project:
[img http://www.thinkcreativ.com/myflashproject.gif]
Cant Get Frame In Main Timeline To Play Frame In Movie Clip
Hi all,
Ok, I want a section of a movieclip to play up until a certain frame on the main, or _root timeline. Then I want a different section of the same movie clip to play. Now I have the movie clip all set up all fine and dandy, yet I cant get it to the frames or 'section' it is playing when it reaches the apropriate frame. I have the following code on the _root timeline frame.
Code:
gotoAndPlay("stop");
(I have a frame label "stop" where it should be) Is this the right code I should be using? It has worked in the past, but it has been in between an on (something) event/action (not quite sure of the correct termanology there)
Please help.
Looping Scenes To Go From First Frame To Last Frame And Rollover Button Play
I'm trying to figure out:
a) how to loop a scene to go from the first frame to the last to the second last etc
WHILE
b) having the scene play either forwards or backwards (as above) while the user has their mouse over a button but making the scene pause when the users mouse isn't over the button.
can anyone help me????
[CS3] GotoAndPlay Exeption (example: If MC1 Frame 30 Is Loaded, Play MC2 Frame 5)
Hi, for a long time i've been struggling to achieve this effect, that is an action script that would allow me to make an exeption. i playes with variables and stuff but i never got it right:/
i have a button, and i have an action assigned to it:
menubutton2.onRelease = function():Void {
content2.gotoAndPlay(2);
IF content3 is on frame 10, i want it to play content3 frame 15,
IF content3 is on frame 1, i dont want it to do anything with content3
};
If only AS could be that easy....
if anyone could help me with this one i would feel relieved... thanks in advance
Play Video In Frame 1 Then Go To Frame 2 On Complete
I am very new to Flash and especially ActionScript... I just want a video which is in frame 1 (I imported an avi which was then encoded and has a skin) to play and at the end of the video simply go to the next frame (or a new video, whatever is easiest) which will have a "Play Again" or "Buy DVD" buttons.
I found the following code from another forum but I do not know how to use it. The playback component is "FLVPlayback" which is what is listed but it looks like "myListener" needs to be changed as it is black (not blue in the code). Do I create a "Listener"? And how?
Thank you!
Attach Code
import fl.video.VideoEvent; // needed to listen for video events
stop();
function myListener(evt:VideoEvent) {
play();
}
FLVPlayback.addEventListener(VideoEvent.COMPLETE,myListener); // "COMPLETE" must be capitalized
FLVPlayback.source = "counting.flv"; // use "source" instead of "contentPath"
FLVPlayback.play();
Gotoandstop (NEXT FRAME) ?
okay i ahve a button and a movie clip
is there a way to script the button so on each click it will then gotoAndStop on the next frame of the movie clip?
thanks
GotoAndStop Last Frame?
It is probably extremely easy an obvious but could someone educate me on this!
I have built a controller that should work in any timeline to conrol a video. One of my buttons is suppose to goto and stop at the last frame of the root timeline. Every root timeline might have a different number of frames so how do I tell it to figure that out?
Thanks in advance.
Mc.gotoAndStop(frame);
inside a if statement the mc.go.... is not working correct, is there there something that I should take care that maybe messing up its funcionality?
if the apresentacao button is clicked at the inicial point the logo should not move but it does, and if the other links are clicked it should move to the top right corner and not move until the apresentacao button is pressed again.
thanks for the help. The file is attached.
Joćo Gabriel
Mc.gotoAndStop(frame);
inside a if statement the mc.go.... is not working correct, is there there something that I should take care that maybe messing up its funcionality?
thanks for the help. The file is attached.
Joćo Gabriel
GotoAndStop(Scene, Frame);
Hi I am trying t do this here,
I have 2 scenes, you start out in this first one, I want a button to goto the first frame in the second scene, ive tried about everything and nothing works, please help.
on (release) {
gotoAndStop("Main", "Intro");
}
Main is the scene intro is the frame, please help.
GotoAndStop To Frame On Another Scene
Hello,
I am trying to put action script on a button instance
so that when the button is released
the user goes to the third frame in another scene
but it's not working -
nothing happens when the button is pushed
in the .swf file.
This is the code I have
code: on (release) {
gotoAndStop("Scenephoto, 3");
}
What am I doing wrong?
Is there a scene naming convention
I don't know about?
Does the code only affect one frame of the button instance?
Please help!
Thanks!
Frame Wont Gotoandstop
im trying to get the movie to gotoandstop at frame 7 when the first menu item has been rolled over.
for some reason its ignoring the line of AS thats telling it to stop and it keeps playing
http://uploadhut.com/view.php/401326.fla
[F8] GotoAndStop At A Frame In External Swf
Hi
I have for example 3 btns in the main movie, a container with instance name container and an external swf with an intro and 3 labels to match the 3 btns. How do I gotoAndStop to the relevant frame within the externally loaded movie?
Code I'm using is;
Code:
on (release) {
_root.container.loadMovie("portfolio_cats.swf");
gotoAndStop("_root.container.cat2");
}
Where am I going wrong? as the external movie just plays at the start??
Thanks in advance
Wayne
[F8] GotoAndStop Fails In Frame 1
If I put a gotoAndStop in frame 1 of my movie, it fails. If I put it in frame 2, it succeeds. However, by putting it in frame 2, the user gets a brief flash of frame 1. I want to conditionally skip frame 1. Here's what my code looks like:
if (_root.myFlag == "a")
gotoAndStop("a");
I've also tried it like this, but with the same result:
this.onLoad = function()
{
if (_root.myFlag == "a")
gotoAndStop("a");
}
I've even simplified it like this, with the same result:
gotoAndStop("a");
Why doesn't this work in frame 1?
GotoAndStop Goes To Wrong Frame
Hi guys,
First post. I'm a fairly new Flash developer and I'm having a problem with a project I'm working on.
I have a button that loads a movieclip on level 4 and passes a string value to it. This movieclip (let's call it web.swf) has it's own timeline and frames are labeled. In the first frame of web.swf, i have an init() function that reads the string and goes to the proper frame.
basically:
if (_level0.string == "fred flinstone")
{
_root.gotoAndStop("frameFred");
}
So everything works pretty well, except that for this certain if statement, it goes to the wrong frame!
I created a dynamic text field to populate with _currentFrame just for testing, and this particular if statement stops at frame 30 (should be 31.) I even tried gotoAndStop(31); and yet, _currentFrame returns 30..... what gives?
To make this even more confusing, frame 31 has some images on it. If I remove the images, the function does go to frame 31! if i leave the images, it always stops at frame 30. arghhhh.
Anyway, anyone experienced this problem before? I'm using Flash mx 2004. Any help/tips would be appreciated!
Thanks!
GotoAndStop At A Frame In External Swf
Hi
I have for example 3 btns in the main movie, a container with instance name container and an external swf with an intro and 3 labels to match the 3 btns. How do I gotoAndStop to the relevant frame within the externally loaded movie?
Code I'm using is;
Code:
on (release) {
_root.container.loadMovie("portfolio_cats.swf");
gotoAndStop("_root.container.cat2");
}
Where am I going wrong? as the external movie just plays at the start??
Thanks in advance
Wayne
Gotoandstop On Frame Label
This what i have....
I have one Scene in this scene are 4 movie clips. In each of these movie clips are 30-40 frames, each of which has frame labels and buttons for each frame. I want to know the actionscript for a button when i am in "movieclip4" when released I want to go to "movieclip2" on a certain frame label inside movieclip2.
Please help. Thanks in advance.
GotoAndStop On Random Frame
I have an MC called asteroid. In the script, every 1000 whatever units its in a new asteroid is attached at the center of the stage. There are two things i cant get to work. #1 i can get the asteroid to stop at a random frame(it has 100 frames). #2 after it's made and has gotten its random frame to stop at i need it's width and height to grow. Here is what I have so far:
i=1;
setInterval(rocks, 1000);
function rocks(){
rock= _root.attachMovie("asteroid","asteroid"+i, i);
i++;
rock._x = 300;
rock._y = 300;
rock.movef = setInterval(rockmove, 10);
}
function rockmove(rok){
// I dont know what to put here; what I tried did not work
}
What would I add to my script to accomplish this task?
thanks
GotoAndStop At A Frame In External Swf
Hi
I have for example 3 btns in the main movie, a container with instance name container and an external swf with an intro and 3 labels to match the 3 btns. How do I gotoAndStop to the relevant frame within the externally loaded movie?
Code I'm using is;
Code:
on (release) {
_root.container.loadMovie("portfolio_cats.swf");
gotoAndStop("_root.container.cat2");
}
Where am I going wrong? as the external movie just plays at the start??
Thanks in advance
Wayne
GotoAndStop On The Over Frame Of A Button
Can I turn a button to its over state by telling the playhead to gotoAndStop on the Over frame? Is there another simple way to do this? Will I have to turn my buttons into MCs? I am hoping to aviod doing that.
Thanks a lot!
GotoAndStop(scene, Frame) In A Mc
how to use gotoAndStop(scene, frame) in a mc?
there's a button in a mc, when I click it, it will change the scene, like this:
on(release){
gotoAndStop("main_scene", 1)
}
but it doesn't work!
_root.gotoAndStop(frame);
i store in the database the frame on which a user ended
i retrive it from the database and store it in a variable "frame" when a user clicks "start" button
but when i pass the variable to _root.gotoAndStop(frame);
it doesn't work root doesn't go to that frame ?
on (press){
_root.pauseEnterFrame=true;
var post_get_frame:LoadVars = new LoadVars();
var post_id:LoadVars = new LoadVars();
post_id.ID = id;
post_id.sendAndLoad("http://e-jobs.pl/e-deutsch/getStartF...et_frame,"POST");
post_get_frame.onLoad = function(success:Boolean) {
if (success) {
frame = post_get_frame.start_frame;
trace(frame);
}
else {
frame = 2;
}
};
_root.gotoAndStop(frame);
}
GotoAndStop Will Not Stop On Frame
I have a movie clip, with several nested clips...
At the end of one of the clips I have a line of code that says:
Code:
gotoAndStop(main1);
main1 is the label of a frame in the _parent movie clip.
Unfortunately this doesnt work and it just starts at frame one in the same clip.
I have also tried the following code:
Code:
this._parent.gotoAndStop(main1);
which has the same result.
when I use this code.. it returns to a previous scene, but not the scene i want to work in.
Code:
this._parent.gotoAndStop(1);
Anyone have any ideas?
Cheers
Dirk
Onclick Go.play Frame 2, Then Go Frame 10?
Hello,
I have a 3 buttons on frame 1.
When I click button 1, I want it to play a movie clip on frame 2, then go on to a specified frame number: say 10.
Button 2 and 3 I want to play the same movie clip but go to different destination frames: say 11 + 12.
So the 3 buttons would have this logic applied:
Button 1: onclick go.play frame 2, then go frame 10
Button 2: onclick go.play frame 2, then go frame 11
Button 3: onclick go.play frame 2, then go frame 12
I have tried out all sort of syntax but just can't find something which works. Could you suggest how I can express this in good syntax?
Thanky
Play Till Certain Frame, Then Go To Frame...?
I'm doing a website on flash, and when it goes from one page to another, i want it to play this little thing, and then go to the next page. is there some way to make a button say something like
"when you click this button, play until it reaches so and so frame, then once its done playing, go to this frame."
I want it to play the same thing every time i switch between any page. so, Id want that code to be on each button, and theyd have the same so and so frame, but not the same this frame, for different buttons.
Go To A Frame And Play A Certain Frame In A Movieclip?
Hi,
This may be a really simple question but I'm trying to go to a frame on the timeline which has a movieClip object in it and then goto a specific frame in that movieClip and I can't figure out how to code it. I thought something like:
gotoAndPlay("movieClipframe");
this.theMovieClip.gotoAndPlay("theFrame");
but I get a null reference error.
Does anybody know what I'm doing wrong or if I'm?
Thanks for any advice
How To Play A .flv File Frame By Frame
I load a flv from code. I want to be able to get the next frame every time I push a button. I tried using seek() and passing it playheadTime+0.045 but it doesn't seem to work. It jumps much more than one frame. (For a flv movie frame rate of 20 per second one frame will occur once every 0.05 seconds so if I seek to the current position + a number smaller than the time until the next frame I should get the next frame). Can anyone give me some advice regarding this?
_root.gotoAndStop (a Scene AND A Frame?) HELP
Hi
I know this must just be a syntax thing but i just can't get it.
I have my main movie loaded into level0 it has 8 scenes.
I have a movie.swf which gets loaded into a blank MC which is in scene 2 in the movie on level0.
There is a button inside the loaded movie.swf which wants to take the user to another scene and frame of the movie in level0.
I think that the AS on the button should be:
_root.gotoAndStop ("scene2", 10)
But it doesnt work. If i take out the "scene2" part it will take me to the frame number specified, but only in the first scene.
HELP!!
////Loadmovie Level1---->GotoAndStop Frame 2 ?////
Hello. Im making a help window that is loaded on level 1 when the user press a button.
My problem is that i want to go to "frame 2" in this window. I tried many times and nothing...i need help please.
GotoAndStop([Scene], Frame) Problems
Hello,
I have the following code in my flash program:
gotoAndStop("mainScene", 1);
When it appears within an on(release) function, it works correctly and transfers to the correct scene.
However, when it appears within a if statement it doesn't work.
Any ideas why this is?
Regards
Rob
Gotoandstop Specified Frame On Main Level
I have a flash movie that plays an intro and then stops. the last frame contain buttons etc for navigating the site. The buttons are in a movie clip named menu. when a user clicks a button it loads a new swf over the top of the original intro (stopped frame), amongst other actions see below:
on (press) {
gotoAndPlay(15);
loadMovieNum("wwd.swf", 2);
}
on (rollOver) {
unloadMovieNum(1);
loadMovieNum("navigatewwd.swf", 1);
}
on (rollOut) {
unloadMovieNum(1);
loadMovieNum("infocenter.swf", 1);
}
To these actions i want to add an action to gotoandstop a specified frame (lets say frame 20 for example) on the main intro. (this will be a plain white frame) I want it to do this before loading the movie onto level 2.
does this make sense?
my reason for doing this is so that the main intro frames are not visible behind the movies loaded to level 2. as i transition through the various pages of the site the background (ie the stopped frame of the intro) flashes briefly before the new swf is loaded on level 2.
any help would be greatly appreciated.
thanks
Flash 8 Gotoandstop Random Frame
im having some simple actionscript problems
I have a flash header here:
http://nikibrown.com/archworks/home.html
I have 3 frames and i want it to go to one of the 3 frames and stop when it loads.
This works fine in safar, but when i use FF for mac it will randomly go to frame 1 and frame 2 but not frame 3? it flashes frame 3 but then goes back to frame 2. God only knows what it does in IE (anyone care to tell me as i am on a mac and dont have ie...)
I have this in frame 1 on my actions layer:
gotoAndPlay (Math.round(1+Math.r andom()*2))
stop();
here is my .fla:
http://nikibrown.com/archworks/headnav.fla
thanks for all the help guys!
nebrow
[F8] Gotoandstop Frame With Radio Buttons
Hello,
I'm trying to create a questionnaire without an xml file. I want to use the timeline and frames along with the gotoandstop function.
The first question works fine and and it sends the user to the correct frame according his selection.
The second question doesn't work. How can I correct this problem?
Fla file is attached. Any help would be appreciated. Thank you.
Code:
stop();
// Listener
var radio_listener:Object = new Object();
radio_listener.click = function(evt:Object) {
var frame:Number = evt.target.data;
btn_1.onRelease = function() {
gotoAndStop(frame);
};
};
// Add listener
rbtn_1a.addEventListener("click",radio_listener);
rbtn_1b.addEventListener("click",radio_listener);
rbtn_1c.addEventListener("click",radio_listener);
rbtn_1d.addEventListener("click",radio_listener);
rbtn_100a.addEventListener("click",radio_listener);
rbtn_100b.addEventListener("click",radio_listener);
rbtn_100c.addEventListener("click",radio_listener);
rbtn_200a.addEventListener("click",radio_listener);
rbtn_200b.addEventListener("click",radio_listener);
rbtn_200c.addEventListener("click",radio_listener);
On MouseOver Tell Movie Gotoandstop At Frame 2
why is this so difficult?
www.mr-bunny.com/nav.fla
its a 7 meg file
I have tried so hard to get the simplest of answers.
all i want to do is:
on mouse over of each button,
tell the movie called TEXT to goto and stop at a specific frame
so when you point to a navigation button, it tells you what page it goes to.
i used to be able to do this long ago on flash 4
now im beating my head against the wall trying everything.
I know it has to be the stupidest thing why it dosent work.
dear god someone PLEASE help me!
Why GotoAndStop() Always Flash The Previous Frame?
Dear all, I found a strange thing like below:
ActionScript Code:
stop();
var mcAthlete:MovieClip = new Athlete();
addChild(mcAthlete);
addEventListener(Event.ENTER_FRAME, Loop);
Athlete.prototype.ChangeShoe = function()
{
if(this.Shoe)
{
this.Shoe.gotoAndStop(2);
}
}
function Loop(evt)
{
mcAthlete.ChangeShoe();
}
the flash always show a flash with the "Shoe.Frame1", But I want to keep the Shoe always in frame2(Shoe.gotoAndStop(2). How I should do?
GotoAndStop(frame) Caching Issue
hi,
as a kind of an image container i created a swf file (using adope Flash CS3) including about 100 single Images(512x512).
On my main as3 application i use the LoaderClass to load this cont.swf.
so far fine, i am able to move to every frame using gotoAndStop(frame).
but it seems that each gotoAndStop(frame) allocates the memory for the frameimage and never release it.
as example:
PHP Code:
var Mov:MovieClip = mapSWF.loaderObject.content;for(var frame:uint = 0;frame<128;frame++){ Mov.gotoAndStop(frame);}
Memory usage dramatically increases with each step. even if i unload the whole swf file using Loader.unload() there is still a huge amount of allocated memory.
is there any way to free the cached memory or extract each frame by its own?
i wonder what is the common way to assemble images? I build that swf file because it is much faster to load a whole container.swf instead of requesting each single image.
thx a lot
GotoAndStop(x) Instantiates Everything Between Current Frame And X?
So, I'm starting to become truly frustrated with a combination of two pernicious aspects of Flash CS3. One of which, the way it handles sound, there's not much to do about... but it gets worse when coupled with this:
So, let's say you have a main timeline that is 10 frames long, and each has a keyframe containing:
someClip_mc
- Which contains someClipChild_mc (a clip with a sound on the timeline starting on frame 2. Frame 1 has a stop action to prevent sound from playing).
Each instance of someClip_mc, s well as the someClipChild_mc inside it is from a different library item, so we have ten different sounds on the timeline.
Now, on your main timeline do this: gotoAndStop(10);
And now all of a sudden you hear a cacophany of sound! It is as though gotoAndPlay(10) caused flash to instantiate every clip that exists on frames 2 - 10, but then before the clips have a chance to execute their frame scripts they are 'removed' from the display list if they ever existed in the display list at all. Since the default action of a movieclip is to play, this is exactly what those nested clips do and because they aren't on the display list they don't execute the stop() action on frame 1! The same can happen if you "gotoAndStop(1)" from frame 10. Any time you use gotoAndStop() it seems to provoke this behavior if you use it to skip over frames in any direction.
So... why in the world does this happen? How can you stop it?
|