ActionScript 2.0 :: If Statement In Button - Timeline Control
Feb 27, 2010
I am having a problem using an if statement in a button. What I want to do is go to a frame dependent on which frame we are already on. For example if I am on frame one and I press the button the first time it will take me to frame five, if I then press the button a second time the actionscript detects we are on frame five so goes to frame ten and so on.
ActionScript Code:
on (release) {
gotoAndPlay(5);
if (currentframe == 5) {
gotoAndPlay(10);
} else if (currentframe == 10) {
gotoAndPlay(15);
} else if (currentframe == 15) {
gotoAndPlay(20);
}}
When I first press the button it takes me to frame 5, the second time I press it goes to frame 10, but when I press after that instead of going to 15 it takes me back to 5 then 10 then 5 then 10 etc and is stuck between going from 5 to 10 and back again.
View 8 Replies
Similar Posts:
Dec 7, 2009
I am trying to use a button to control a timelineie if you click once you gotoAndPlay frame 2, the next time you click the same button you will gotoAndPlay frame 22, then gotoAndPlay 44 etc.I have spent the last couple of days trawling forums and a variable seems to be the answer, but I am not sure if this is correct.
View 6 Replies
Sep 1, 2010
So im creating a site for a friend and I have placed the menu inside a movieclip so the buttons are inside the movieclip and want them to control the main timeline. This the script i have tried :
Code:
stop();
natural1.onRelease = function () {
[code].....
View 2 Replies
Oct 26, 2009
I'm creating a schedule page which has a calendar and a timeline (a graphic timeline not the flash timeline) that need to interact. When someone clicks on a calender date I want it to jump to that date on the graphic timeline. In order to cut file size down I split the calendar and the graphic timeline into two different files which are both loaded into a master page. The calendar is on level 1 and the graphic timeline is on level 5.
Sorry if this question is confusing, I'll try not to mix up the graphic timeline and the flash timeline, but -- Is it possible for a button in the calender file to trigger the graphic timeline file to change frames? What would that code look like? I tried on(release){level5.gotoAndStop(2)}, but that doesn't seem to do anything and I don't get any error.This might be really simple or impossible for all I know..
View 2 Replies
Jul 1, 2004
I have 2 scene, using button to swap in between file. If the button is in maintime line i can swap in between but my button is inside a movieclip in scene_1. After I click it reload the scene_1 and my script on button is:
on (release) {
nextScene();
}
Is it using
_root or
this.(dot)
.
View 6 Replies
Jul 1, 2004
i hav 2 scene, using button to swap in between file.if the button is in maintime line i can swap in betweenbut my button is inside a movieclip in scene_1. After i click it reload the scene_1,and my script on button is
on (release) {
nextScene();
}
[code].....
View 5 Replies
Aug 13, 2011
I have a movieclip inside the OVER on a button, right now I have an animation that causes the button's brightness increases from 0 to 10 over 24 frames and then come stops because of a stop (). I now intend to add an animation after stop () which gets the button's brightness goes back to 0 again when you no longer hold the mouse over the button. I would therefore like to make some kind of mouseOut event that allows Movieclip go to the next frame. I have tried to insert a target path but it seems that it can't reach the movie clip inside the button.
View 1 Replies
Oct 2, 2009
I have a thumbs_mc with thumbnail images. Within thumbs_mc, I have a transparent overlay_mc that functions as a button. Mouse over the overlay_mc and the alpha chages so there is a tint over that particular thumbnailWhen overlay_mc is clicked, the main timeline goes to a particular frame label.What I need to do is have the position of the playhead on the main timeline also determine the alpha of the overlay_mc so the viewer knows which thumbnail is playing.
View 1 Replies
Oct 16, 2010
I have a stop on my main timeline. At the stop I have a movieclip play. In the movieclip I will have a video play. After the video plays I have a button for the user to continue play until the end of the movieclip. Once the movieclip is done I want to resume back to a specific frame in my main timeline.
View 3 Replies
Oct 28, 2010
First off, I have a movie clip called mc_instructions. Inside the movie clip, about 940 frames into it, a button appears called btn_ready. I need this button to bring me to frame 3 on the main timeline when clicked on.
View 1 Replies
Feb 7, 2011
I am trying to do a simple thing in theory. In my main timeline I have a series of images with frame labels for each. In a movieclip (with its own labels) below the images, I have two panels of butttons that flop back and forth (to save space). The idea is to simply have the maintime play the frame specified by the corresponding button in the movieclip. [code]...
View 1 Replies
Feb 13, 2007
I want two radio buttons on the 1st frame. if you select rbA and hit a button you go to frame label "loading" and if you select rbB and hit the button you go to frame label "sorry". I found this code below that says it does what I need but I just can't get it to work. I have attached fla.
stop();
rbA.setLabel("test");
rbA.setData(2);
rbB.setLabel("test2");
rbB.setData(3);
[Code] .....
View 6 Replies
Jan 31, 2009
I created a Movie Clip with a button inside it. The Movie Clip contains simple animation within its timeline. I dragged the Movie Clip to the main stage and tested the movie/ My goal is to have the button start the animation inside the Movie Clips timeline but it is not working.The Movie Clip instance is named 'film_mc' and the button inside it is named 'first_btn.' The frame is labeled 'one'. I tried these two Action Scripts that I put on the main timeline. Where am I going wrong?
film_mc.first_btn.onRelease=function(){
film_mc.gotoAndPlay("one");
}
[code].....
View 1 Replies
Jan 13, 2009
I have a button action not working to control another movie clip timeline. The movie clip timeline I want to control has an instance name but for some reason it's not playing. The button is on a different movie clip timeline. Both movie clips are on Scene 1. I think there is something wrong with my target path?
on(release){
_root.insMcWorkNav.gotoAndPlay("lbWork04");
insMcWorkNav is the movie clip, lbWork04 is the frame to play
View 5 Replies
Nov 3, 2004
I've created a movieclip with buttons inside that I want to use to navigate to different scenes on the main timeline. I have created a function() that loads the button movieclip into the main timeline, but if I try to write a function() to activate the button and move the main timeline to a different scene/frame label it doesn't work. I have tried various things:
navBack_mc.book_btn.onRelease = function() {
_root.gotoAndStop("book1");
}
I put the code above on the main timeline. It doesn't seem to work. Basically, I could put just an on(release) handler on the buttons, but I wanted to try to keeping all the AS in one place if I can.
View 7 Replies
Nov 3, 2004
I've created a movieclip with buttons inside that I want to use to navigate to different scenes on the main timeline. I have created a function() that loads the button movieclip into the main timeline, but if I try to write a function() to activate the button and move the main timeline to a different scene/frame label it doesn't work. I have tried various things:
navBack_mc.book_btn.onRelease = function() {
_root.gotoAndStop("book1");
}
[code]......
View 7 Replies
Oct 23, 2009
I have a button inside a movieclip, to which I would like to apply a rollover function. When rolled over, this button (inside MOVIECLIP 1) would make (MOVIECLIP 2) jump to second frame. I'm using Flash 8.This is turning onto a real headache for me, since i've searched every single forum and thread concerning this matter, and nothing seems to work.
View 7 Replies
Aug 30, 2009
On my main timeline, I load a mc from the library with:
text_content.attachMovie("text_content", "text_content", 10);
There is a marker inside this mc called "news". I need a script in the main timeline that will gotoandStop "news" within the "text_content" mc.I have tried, amongst others
[code].....
View 4 Replies
Nov 26, 2008
I'm using Flash MX 2004 Actionscript.
I'm trying to get control of the time line using a conditional statement.
if (myVars.logged == "Logged") {
gotoAndStop(20);
}
I trace the myVars.logged variable and the trace tells me the value is Logged.
But the above statement won't go to frame 20.
View 9 Replies
Mar 3, 2010
figure out what is going wrong with this bit of code? I have a movie clip button called play_mc and when the user clicks on it I would like the timeline to stop and the play_mc state to change to frame two. Then when the user clicks on it again, I would like the timeline to start again and the play_mc to go to frame 1.
Actionscript Code:
play_mc.addEventListener(MouseEvent.CLICK, playCurrFrame);function playCurrFrame(e:MouseEvent):void {f (play_mc.currentFrame(1)) {
[code]....
View 2 Replies
Dec 18, 2011
I have a movieclip on the screen called "mc_bg". Within this movieclip are 7 movieclips called "barrier1" through "barrier7".From main.as I want to be able to do this call:
for (var i: int = 1; i < 3; i++ ){
trace("got here")
trace(mc_bg["mc_barrier" + String(i)])
[code]....
View 1 Replies
Jun 24, 2004
i'm trying to use if statements but can't get this thing to work i want to check if another button is visible on release of a button to determine what action to be taken.the 'gotoAndPlay("firstscene",1)' is just there as an outcome, will be changed later. anyway this is the code i've got on the button i'm pressing. blobyellow2 is an instance of a button blobyellow is it because it's an instance that it's not working?
[Code]...
edit: sorry forgot to put what's wrong with the code. it acts as though the statement is correct no matter if it is or isn't.
View 11 Replies
Dec 3, 2009
Where can I find ready-made buttons that will control an FLV and a timeline together? I have a swf with an FLV and I animate images and phrases on a movieClip timeline timed to what they say in the flv. I set up cuepoints that trigger the animations, so when users scrub, pause, etc. the timeline eventually catches up with the FLV, but it would be a lot nicer if the pause, scrub, etc. would do the same to the timeline and there was no lag time.
View 1 Replies
Apr 30, 2009
I am just trying to use actionscript 3.0 (Flash CS4) to change the 'Parent' timeline from a button in the 'Child' timeline
[Code]...
View 2 Replies
Jan 18, 2010
in AS2 how would i use the down arrow key to make the timeline play? at the moment i have this and i presume i need to put something after that to make it play. [code]but i presume this is totaly wrong because the "stop();" doesnt stop the clip when the "if (Key.isDown(40))" bit is after it.
View 2 Replies
May 22, 2009
I have an application with a collection of sounds in the timeline. One sound file is recorded at a slightly lower volume than the others. I know I could change this in Audacity but I'm wondering whether I could attach a line of actionscript to its button to raise its volume slightly.I know its possible to do this when playing sounds with actionscript directly from the library, but that would be too big a departure from the development style used.
View 1 Replies
Mar 29, 2008
I am creating a very simple presentation in CS3, which will be projected on-screen and will have a live speaker. I would like to be able to pause the SWF at various locations along the timeline so that the speaker my discuss issues on the screen, and then presume playing it. Since don't want this control visible (such as with a button) to the audience, I would like the control either with the press of a key, such as the arrow right key, or with a remote controller. How would I encode this both with the press of a key or with a remote controller?
View 10 Replies
Jul 13, 2006
i know i've done this before! i have a swf. 4 labels. a stopat frame 1. i embedd this into my main timeline. i have 4 butons inan MC in my main project, going to specific labels in my maintimeline, where i have the following code, attempting to load theswf and jump to that label:
this.container_shell.loadMovie("interact01.swf");
interact_shellb.gotoAndStop("label1");
its not working. the swf loads, but i can't jump to thelabel
View 5 Replies
Feb 17, 2009
in the old version of flash, there was an option in the property inspector where one could have assigned ie. 8 seconds to a keyframe (esp. text) so one could read the let's say 3 sentences before the next set of sentences came on the stage. i swear there was an option for this in flash 8. can anyone tell me how to control the timing in flashcs4 in between frames? i know how to make the very last frame stop( ); in actionscript 3.
View 2 Replies
Sep 8, 2009
I have sound on the timeline.
Also I have the following buttontns[code]...
View 1 Replies