GotoAndPlay And Then Skip Frames In Timeline?
Jul 25, 2009
I am looking for an actionscript that will go to a certain frame in the timeline, play several frames and then jump to another frame in the timeline. Basically, I want to use this on several different buttons that use the same animation sequence to get to another part of the timeline.
The following is a scenario, but not script:
Buttons A and B are on Frame 1. Animation is on Frames 2-20:
When Button A is pressed, go to Frame 2. Play Frames 2-20, then go to Frame 21.
When Button B is pressed, go to Frame 2. Play Frames 2-20, then go to Frame 22.
I am currently doing this in a different way.
Buttons A and B are on Frame 1. Animations for Buttons A and B are the same, but are located on different frames. Animations for Button A would be on Frames 2-20. Animations for Button B would be on Frames 21-39. So...
When Button A is pressed, go to Frame 2. Play Frames 2-20 and stop on Frame 20.
When Button B is pressed, go to Frame 21. Play frames 21-39 and stop on Frame 39.
Do I have to create this extra timeline? Can I just put the animation in a separate movie? How can I play the movie and then connect each button to different parts of the timeline after the movie ends?
View 5 Replies
Similar Posts:
Jan 4, 2004
I have a movie that plays as an introduction. If a user wants to skip the movie and go to frame 225 but continue playing the movie then I thought I would use this code:
[Code]...
what actually happens is the movie skips to frame 225 but then stops. Now if I leave the movie to play from the start it will get to 225 and continue playing... strange??? Yes... Here is the file:
[Code]...
View 1 Replies
Jan 16, 2004
lets say when a button is released, it will play from frame 1 to 10 then it will skip the 11th frame then go to the 12th frame btw, the 11th frame has a stop action script on it
View 8 Replies
Jul 14, 2009
I am editing a .FLA file that has been given to me. I would like to have the movie jump frames (skip frames) to cut out a part of the movie so I do not have to edit the time line. What is the Action Script that I should use?
Right now on the frame I want it to jump from I have
gotoAndPlay(8220);
This does not seem to be doing the job.
View 3 Replies
Feb 7, 2011
I'm creating a flash game which uses time intervals with setInterval and sometimes does heavy calculations. The problem is that on slower machines these calculations can't keep up with the framerate and the movie slows down BUT the timers are unaffected what makes them asynchronous to the movie. Looking back, it was a bad idea to use timers but I can't change it back now. So...is there a way to skip drawing frames?
View 2 Replies
Jul 2, 2011
Game I'm making slows to half the speed when there's a ot going on. I'm sure I'll be able to get rid of a lot of that whe I optimize it, but is there some way of telling flash to skip frames when things get slow?
If not, was thinking I might be able to change the speed of the character so when the frame rate drops to half they get twice as fast.
View 5 Replies
Mar 25, 2009
I need to create a button that will make a movie clip slide over 24 frames from the current frame the movie is on when the button is clicked. How I can do this with actionscript?
View 7 Replies
Aug 1, 2010
how to make my "animation" (more of an interactive slideshow) skip forwards and backwards by two frames rather than one.
Each frame's action starts with stop(); and I know how you can implement the Action script to register keystrokes, the problem is I can't get how to jump by 2 rather than 1 frame at a time.
It would be preferable not to have to use gotoAndStop(#); on every 2nd frame as I have over 350+ frames.
View 1 Replies
Jan 4, 2009
I've got some tabs that are filled with an XML attribute named tekst. Now with some basic actionscript, I do a check t see if any attributes are undefined. If so, leave the dynamic textfield blank and set the _alpha of that specific tab at 0; this all works fine.
The only thing I want to achieve is, when say only tabs 1 and 2 are filled, I want to start the animation over after tab 2 has finished. At the moment the animation plays all 5 tabs and then starts over.
I tried a 'simple' myMC.gotoAndPlay(5), but this didn't work. (5 is the framenumber from which the animation must start). I thought maybe I'm calling something that isn't there, so I tried only gotoAndPlay(5); this didn't work either, because my MC with all the animations is not on the .root timeline.
View 11 Replies
Feb 10, 2009
I was following this tutorial: [URL] To make the buttons feel more smooth, can anyone modify the Actionscript to make it so that the animation on the "over" label not skip even if the mouse is no longer on the button or rerolls on the button too early? (In other words, let the "over" animation finish even if the mouse leaves the button, thus letting it finish before it goes and animate the "out" label). I hope that isn't too confusing.
[Code]...
View 1 Replies
Apr 14, 2010
I have a movieclip in the main stage that has several frames. Then, I created a separate layer for the code that goes like this:
Code:
addEventListener(MouseEvent.CLICK, nextPage);
function nextPage(e:MouseEvent):void {
this.gotoAndStop(this.currentFrame+1);
}
Except for the last frame, which does not contain this code, seems to perform as expected. However, when I called up the same movieclip again by having it go back to a certain frame:
Code:
tutorial_MC.gotoAndPlay("2");
And the whole stuff seems to work fine, when I click and expecting the frame to go to the next, it seems to skip one frame and land on the other instead. For example, if I'm on frame 16 it'll jump to 18, then 20, and so forth. I tried other alternatives but they all seem to yield the same result.
View 4 Replies
Aug 11, 2009
I'm having trouble with skipping back to frame 1 after having skipped forward to frame 2 using buttons. The button which is suppose to skip back won't work and the errormessage I get after previewing is:
Error #1009: Cannot access a property or method of a null object reference. at page3/frame1()
Here's the code:
stop();
galBtn.addEventListener(MouseEvent.CLICK, clickFunction);
function clickFunction(evt:MouseEvent):void {
[code]....
View 4 Replies
Mar 19, 2009
I got 2 buttons that i want them to gotoAndPlay at different frames... here is the code
[Code]...
when i play the .swf i get an error message
View 3 Replies
Sep 29, 2009
created a (what I thought was simple) gallery.I have all the large images on a timeline layer were each image fades in over the course of half a second then stops. I created navigation buttons, next and previous on each frame that are supposed to navigate to the next image. The action script for the nav buttons is different depending on which image (frames) you are on. However, when I publish the swf the next and previous buttons don't go to the frames I prescribe for them in Actionscript, but just go to random frames in the timeline. Also, I have a series of thumbnails that have actionscript that navigates to pictures/frames when clicked so I don't know if they are interacting badly. Does anyone have any idea whats going on?Here's an example of the AS for the previous and next buttons (instance names prev_btn and next_btn):
prev_btn.addEventListener(MouseEvent.CLICK, navback1);
function navback1 (event)
{
[code].....
View 2 Replies
Apr 7, 2010
It seems like no matter where I check, there isn't a clear answer to this particular issue.Rather than blabber on about the code, I think it is important for me to address that I may just not be setting up my document correctly. At present, I created several layers, some in folders, for a basic portfolio website. I have my problems with my main buttons, in my "Sections" folder, where each button is a distinctive layer so it can be animated when it is pressed.I have a button called 'architecture' that is pressed, but instead of just statically moving the frame to the desired content, I want to play 5-7 frames that I tweened for a small transition (sometimes opacity, sometimes sliding mask) that occurs right before the content. All my transitions and everything is just on this one main timeline.
Basically, I sort of want to have the best of both worlds, where I can goToAndPlay, but then stop it at the end of that segment, as to not run into my next frames of content.My first solution was to simply place a stop(); at the end of the transition, but then the menu just locks and stops. Of course this was on my top layer named 'actions.'I then tried applying each event listener to it's buttons' layers, but that resulted in the button simply not working.I segmented up the actions layer into keyframes, but then realized that it didn't call on the event listeners if I did that.
View 2 Replies
Mar 15, 2010
We have 5 buttons that each go to another frame e.g Product, Contact etc. but we want to play the same series of frames (an outro) and then goto the frame that corresponds to the button. Weve tried lots of different examples from the already posted questions and nothing will work. The latest I tried:
[Code]...
View 10 Replies
Jun 13, 2011
I am working with some actionscript that are spread out amongst different frames, and having changing conditions, determines whether to end the sequence (gotoAndStop(1)) or continue (gotoAndPlay(5))
(For easy example):
frame 4=
x=1
frame 5 =
x=x+1
frame 6 =
if (x=10){
gotoAndStop(1)
}else{
gotoAndPlay(5)
}
I understand this easy example could be done several ways on one frame easily, (while x<10, etc).. but my code is so long and complicated, that the way I wrote it, it was easier to have it sort of "loop" between frames. The problem with this is, I think the frame jumping is slowing the coding down. I tried functions, (like having all coding in frame 5 as a function, then calling that function with the "else" in frame 6), but that would only run the function once.. I need it to keep looping.
View 2 Replies
Nov 12, 2010
I have an main.swf that loads home.swf on the stage. In home there are mc's that when clicked take you to different frames inside home.swf I need to have a gotoAndPlay eventlistener off a button which would take the user back to frame one of home.the home .swf has 6 frames with different clips in each frame on one layer, text for the back to first frame on another layer, an invisible btn and an actions on two separate layers
first question :
the individual frames are 7-8-9 the gotoAndPlay action is on frame 7 ONLY the button only works when in frame 7 if 8-9 are not individual blanks why doesn't the button work when in frames 8 and 9?In other words can't I use an action that triggers a function assigned to a button that spans across more than one frame?if the button spans across 7 - 8 - 9 and the action frame is on 7 how can I get this to work?
View 5 Replies
Aug 19, 2010
here is what I am trying to achieve in as3 in as2:
Code:
var randomNumber = Math.floor(Math.random()*3)
if (randomNumber == 0){
gotoAndPlay(1);
[Code]....
on frame 1, 30 and 60 there is a different animation, with this code at the end of each animation it randomly chooses one of the optional frames to play from.
View 8 Replies
Jan 29, 2011
Basically I have a MC called 'plane3.' Inside that MC is another MC called 'plane2.' Inside 'plane2' is an animation on frame 5.(inside the MC 'plane3' the MC 'plane2' is on a classic tween going side-to-side from frame 1 to 99, once it gets to frame 99 the code gotoAndPlay(1); makes it go on loop back to the beginning)My question is how would I go about: when you click 'plane3' it lets the tween continue playing until frame 10, then on frame 10, it gotoAndPlay (100); in the same MC and ALSO plays frame 5 from inside 'plane2'
View 5 Replies
Mar 6, 2012
I am using a mouseEvent listener
iBubble1.addEventListener("click",doStuff);
to call a function that uses gotoAndPlay to send the playback head to a certain animation on the timeline.
function doStuff(evt:Event):void {
gotoAndPlay("popped");
}
Should be so simple. But the first frame of the "popped' animation, often the first 2, do not display. (when testing the compiled app, even the first 3-4 frames often do not display)Without the mouse event listener, using gotoAndPlay("popped"); to move the playback head to this animation from another spot in the timeline works just fine, so that's why I suspect the mouse event is involved in the bug.using
trace(currentFrame);
in the function after gotoAndPlay, does trace the correct first frame number of the animation, but this frame is not displayed, the animation just starts with the 2nd frame, or 3rd..or sometimes 4th.
View 1 Replies
Mar 19, 2010
how to literally describe what I want to achieve. But I believe it is an easy achievement for someone who is a little familiar with Actionscript (2).
I have a movieclip with backgrounds that fades in and out as the timeline within the movieclip plays. What I wanna do I place an actionscript at frame 1, before any of the background plays, that randomizes a gotoAndPlay function that jumps to a decided frames out of frame 2, 77, 152, 227, 302, 377 etc.
It should be a problem to use the same actionscript after each background has been shown? If it is, its no problem, doesnt matter too much. As long as the first background that is getting randomized is different each time you visit the website.
View 3 Replies
Dec 5, 2009
how many of you use scenes to get your projects done. I've been switching to a different scene for every new angle (I'm making a flash movie, drawing somewhat 3D perspective, and storyboarding it out like a movie.) I find it makes it easier to organize the timeline, and not take up as many frames per timeline. Are there any downfalls to this method? Because I'm early on in the production, and if there's going to be any problems down the road I'd like to know before I get too involved.
View 1 Replies
Dec 6, 2005
I have a main navigation bar on my main stage that is constant through out. I have converted the bar to a movie clip. How do i then tell the movie clip to look at the main stage, not inside the mc, when a button/mouse event is clicked. This is what i have.
stop();
name_btn.addEventListener(MouseEvent.CLICK, enterMovie);
function enterMovie(myEvent:MouseEvent):void{
[code].....
View 1 Replies
Nov 23, 2009
is there anyway to have a button play frames 5-10 on a movie clip inside the current frame, as well as skipping to...lets say...frame 10 of the scene?
i want to create a site where buttons go to different pages, but those pages have animations in and out.so if someone is in one page, and clicks a button to go to another, that page plays the "out" animation while the other page plays the "in" animation.
View 1 Replies
Nov 23, 2009
I'm trying to play a frame label that is on the main timeline by clicking on a button inside of a movieclip.Here is the error I'm getting. I most definitely have a page1 label on the frame.[code]
View 9 Replies
Mar 23, 2010
I've got a timeline and four buttons which each gotoandplay from the first frame on the same timeline. But I want each button to Stop() at different frames on the same timeline. So is it possible to do a GotoAndPlay ... And Stop function on a button in flash?
View 3 Replies
Nov 23, 2010
I was wondering if there is a way to tell flash to navigate to a movieclips timeline without that movie clip being on stage or having an instance...
For example i have MovieClip1 in my Library and its named MovieClip1...but its not located on the stage...
View 6 Replies
Dec 6, 2011
I am trying to use a button on frame 1 to go to a movie clip that is on frame 1018 ( i put the movie clip on the main timeline on frame 1018)
so main(root) --> 1018 --> shipattack_mc ---> "endtest"
I have tried using these commands and a few variations of the same thing. _parent this.
shipattack.gotoAndPlay('endtest")
gotoAndPlay("endtest")
My main timeline ends at 1018 with a stop() and the movieclip "shipattack_mc" plays out its 1000 or so frames. I am testing some things towards the end of the shipattack and want a button to skip to the end.
View 3 Replies
Aug 12, 2009
I have a main timline with MCs in it. when the MC gets to the last frame, there's an onEnterFrame event telling the main timline to go back to frame 129 (labled "b1") and play.
I got the MovieClip(root).gotoAndPlay("b1"); part added to my function to call the root. however, when I test the movie, it does everything correct except play. it goes to b1 and stops. here's my as3:
code: this.addEventListener(Event.ENTER_FRAME,goBack);
function goBack(e:Event):void {
MovieClip(root).gotoAndPlay("b1");
}
why it won't play? I've tried using just the frame number and that won't help either. there's nothing else on the main timeline to stop the movie...
View 4 Replies