Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Problem With Goto And Play



I'm having a strange problem with GOTO. The button, which brings you to a new scene is working, but you have to click on it twice, which is annoying and something I'd like to get rid of.

There are no movie clips. Only a series of scenes that correspond to the navigation.


Code:
on (press, release) {
gotoAndPlay("Biography", 1);
}
Any suggestions would be greatly appreciated.

thanks,

Andrew



FlashKit > Flash Help > Flash MX
Posted on: 05-24-2004, 06:33 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Script: Play 5 Frames Then Goto ? And Play
How do I tell Flash to play five frames and then goto somewhere else and play?

Also, how can I tell Flash to play five frames and pause for 4 seconds and then play again and pause for 4 seconds without creating stop actions on frames?

thanks everyone

Here's a link to my very first flash site, let me know what you think...

http://idisk.mac.com/michalp/Public/vsoh6.html

Goto And Play Help
in my sig i have a movie clip that plays the text. what i have done so far is i got the text to stop looping, and now i am trying to figure out how to click on it and make it play again. i created a button and have tried

on (release) {
gotoAndPlay ("Scene 1", 1);
}

but it doesnt play it when i click on it. the text plays 1 time and stops and that is it. how can i click on the button (the button covers the text and alpha=0) to make it play the mc again?

GoTo And Play
Ok I have made a movie in flash

inside that movie I have made another movie...in that movie I have a button that has an actionscript command 'go to and play'

now I have set it to play the exact key frame and the exact scene. However it doesn't work. What in the world am I doing wrong.

If I have the button go to a key frame inside the movie thats inside the main movie it works, but for some reason it will not go to the scene I specify. Is there something I can do about this??

Any help is appreciated

my ICQ # is: 26305725

Goto And Play
Can anyone help me? When you use the gotoAndPlay command, and you specify a framenumber or label, the playhead doesn't always returns to that frame. The playhead often plays a previous frame, although you specified the framelabel or number. What am i doing wrong??

Help With GoTo And Play
I have a button that says "On Release, GoTo and Play Scene 2,frame 1

thisi s fine but how do I say and go to the top of this page... it is staying at the bottom... probably because the button on the previous page (scene) is at the bottom.. I know how to do this in HTML but no clue in flash

Goto And Play... Please Help
Hi, thanks for visiting.

I think itīs not a big problem, but i just donīt check it. Iīve got an animation in the main timeline. Its a cubus that is coming up - stops - going down.
Now I have another animation that is not in the mainTimeline. How can I tell the Button in the second animation, that it should go to the named frame and continue playing the Animation in the main timeline.

Thank u for helping...

Goto And Play
What action script would I add to my button, so when it is pressed, it goes to frame 40, and plays the movie from there.

At this point, the movie was stopped by a stop action, and the button is present on the page, so I want the movie to skip to frame 40 when the button is pressed.

How do I do this?

Goto And Play From MC
Im having trouble with playing another scene from a MC.

In Scene one, I have a MC. When it runs to the end of the MC it suppossed to gotoand play Scene2 frame 1. Ive tried everything I know to do so, but it does not work. Any Ideas?

Info on the MC:
The MC is a logon movieclip and if your logon is successful then it is suppossed to play Scene2 with other movie clips. It does not work.

Thanks in advance.
-Dan

Goto And Play Help
I have been working with actionscript for buttons and have come to a problem. I am trying to get my end movie button to go to scene 1 frame one to replay. However when I type this code:

on (release) {gotoAndPlay([Scene=Scene1],frame=frame1);
}

I get this error:


**Error** Scene=Scene 15, layer=Layer 1, frame=1130:Line 1: ')' or ',' expected
on (release) {gotoAndPlay([Scene=Scene1]frame=frame1);


I am using Flash MX 2004. If anyone can tell me what I am doing wrong I would appreciate it.

Not Just A Goto And Play
hey whats up ! first post here at Flash Kit ya ya ya
ok this thing is pissing me off. Whats going on!!!

ok I have a movie (SWF) called "projects" it is loaded in to a MC called "Content" which resides in a SWF called "newportsite02"

Projects.swf has a preloader with this code:
stop();
var bt = _root.content.getBytesTotal();
kbt.text = Math.round(bt/1000);
_root.content.onEnterFrame = function() {
var bl = _root.content.getBytesLoaded();
var pr = bl/bt*100;
kbl.text = Math.round(bl/1000);
prl.text = Math.floor(pr)+"%";
_root.content.barprojects_mc._xscale = pr;
if (pr == 100) {
delete this.onEnterFrame;
play();
}
};

When this code = play it jumps to the next scene called "main"

now I have a 20 buttons in newportsite02.swf these should load projects.swf in to the MC "content" and go to the respecting frame.

Each of the buttons have to check to see if projects.swf has been loaded because I dont want to keep loading it if it is there.

Here is the code I have on the button that is not working:

on (press) {
_root.p = 1;
if (_root.p2==0) {
loadMovie("projects.swf", _root.content);
loadMovie("guide.swf", _root.guide);
_root.content.onEnterFrame = function() {
if (_root.content.pr == 100) {
_root.content.gotoAndStop("main",5);
delete this.onEnterFrame;
}
};
} else {
_root.content.gotoAndStop("main",5);
_root.content.description.gotoAndStop("main",5);
}
_root.p2 = 1;
}

any help would be great!

if there are questions let me know.

Goto And Play
I have a movie clip in my SceneB, and at the last frame of that movie I tell it to gotoandplay SceneA, frame 1. But instead it goes back to SceneB and plays frame 1. I have tried a couple combination of things, but thought it's best to toss this question on here. Why would the code not see outside the current scene? Hope this makes sense and thanks in advance.

Cheers,

Wes

Goto And Play
i am trying to navigate from a button within a move clip on frame 2 of scene 1 back to frame 3 of scene one which is called game.

on (release) {
gotoAndPlay("scene1", game);

}


ahhhhhhh it dosent do anything does any1 happen tyo know why?

On Play Goto Scene?
hi. i tried searching for a thread with this but was unsuccessful . . could i get some help on this? i don't think it's a very hard one but i'm kinda new in actionscript. .

i've got a .swf with 3 scenes on an html page.
the first time the page loads the first scene plays and then stops.
if you mouse over that it will play scene 2 and stop. mouse over scene 2 it plays scene 3 and stops.
mouse over scene 3 and it plays scene 2. and continues the cycle between scene 2 and 3.

now on the html page there is a frame. there are links on the same page as the swf. every time a link is pressed it loads a page inside the frame, and at the same time it gives the command to play the .swf.

what i want to happen is for the .swf to see if it's in scene 1, 2, or 3.

if in scene 1 (when the play command is issued)play scene 3.
if in scene 2 (when the play command is issued)play scene 3.
if in scene 3 (when the play command is issued)play scene 2.

is there some way to set this up so that the swf can do this? also, where do i put this action scripting? would i need to put one on each scene? or just on scene 1?

thank you in advance for the help. .. 8*)

looooooooove,

botti

Goto And Play (variable Name)?
Hi there,

I have some code that I need some input on.

A variable is set with a value.

This value is the name of the frame that I want the movie to goto and play.

How do I get the go to and paly command play the frame tat is in the vairable

Goto and play frame lable (variable)?

I have tried a few different ways such as setting the properties to Lable and Expression. I have tried the eval command as well as many combinations of brackets and quotes.

Any ideas?
Thanks, Mike

Double Goto And Play
Hi all.

Is there a way to specify a command on a button that says go to and play frames 10 - 20 and THEN goto scene 2 and play frame one ?

I can't place the 'goto scene two' command on frame 20 of scene one. I need it to be on the button.

Any help please ??

Question About Goto And Play.......
I am having a little trouble. I have a movie clip that is 100 frames long.
Now I took this movie clip and placed an instance of it in frame 1 along with
a stop action so that the entire clip will play before moving to frame 2 of
the main timeline (scene 1). Okay, now in the 100th frame of the movie
clip that is sitting in frame 1, I put:

gotoAndPlay ("Scene 1", 2);



I did this because in frame 2 I have another movie clip that I want to play after the
clip in frame one has played. FOr some reason, the clip in frame one just repeats itself
and never jumps to frame 2 to play the next clip. What am I doing wrong?

Goto And Play (random)
Anyone know what the script would be to get a movie clip to loop by targeting a random frame?

Got a clip of 30 frames long and want to put the script in the 30th frame to go to a random place in the subsequent 29 frames.

Any ideas?!


telekin:
__________________________________________________ __________

Goto And Play Button
I'm having trouble with the action script needed to skip my intro movie.
I would like to goto and play the last frame of the movie as this contains action script to popup a new window.

I'm sure there is a simple action script for a goto and play button but I just can't get my head round it!!

Any help very gratefully received

Goto And Play Problem
Here's the senario:

I've got a movie (maps) within another movie (beltway). I'm trying to code a button in the "maps" movie to return to frame 28 in the "Locations" scene within the "beltway" movie. here's the code I'm using:

on (release) {
_parent.gotoAndPlay(Locations, 28);
}

It seems simple enough, but I can't seem to get it working. Any help would be greatly appreciated.

Can There Be A Goto And Play Next Frame?
Or is it just
on (release) {
nextFrame();
}

and it stops on the next frame... i want it to play the next frame, how so?

Using Variables In Goto And Play
Hi,
I am using Flash4 in a PowerMac (an old model).
I am trying to control a movie clip loaded in level 2 , with an action attached to a button instance in level 0.
Once loaded the movie, if I try the movieclip to go to frame 2 with the order "goto and play (2)", everything is OK. But if I try to direct it using a variable, it doesn't function. The variable is set after pressing another button, in the same level 0.
To debugg it, I've placed some textfields, where this variable is showed. Everything is OK, but it seems that the value, that do appear in the textfield, cannot reach the movieclip at level2.
Why?
I have the same problem, even with a movieclip in the same timeline (so I guess it's not a problem of paths). Can I use variables in Goto actions? I am sure I can. But how can I pass them?

A sample of the code:

On (Release)
Set Variable : "z" = 2
Begin Tell Target ("/movieclipinstance")
Goto and Stop (z)
End Tell Target
End on

In the case of the button that address a movieclip previously loaded at _level2, the variable is already set by another button, and this button tries to direct this movieclip using that variable:

On (Release)
Begin Tell Target ("_level2/movieclipinstance")
Goto and Stop (z)
End Tell Target
End on

I know that the path to the movieclip is OK, because if I replace the variable z with the value 2, it functions. I've tried to change the path to the variable to:
Goto and Stop ("_level0:z") or even Goto and Stop (_level0:z), but nothing happens.
Any help will be much appreciated,
Marcelo

Goto And Play By Clicking
what script would I use to goto another frame just by clicking anywhere on the screen.

I thought maybe this would work:
Code:
if (mouse.down) {
gotoAndPlay(2);
}
but it didnt. Does anyone know why?

Multiple Goto And Play
Hello.

I am building a portfolio website for my graphic design work. I was hoping to have each piece come up, then when a link is hit, that paricular piece will move off the screen to the left, and then the desired piece will slide on screen from the right.

I have tried to set up scenes for each piece in which the first 10 or so frames would be the piece coming on screen then a stop, and the last 10 would move it off. The problem is, I don't know what to do with the ActionScript to make it do both of the separate plays once a new link is hit (PLAY the exit frames for the current piece, then GOTO AND PLAY the scene of the new piece) ActionScript says I can't have multiple GOTO AND PLAYs, and I can't for the life of me figure out how to get those simple things to play.

I understand very basic programming, but any non-movie control solution would have to be pretty detailed if I am to get it.

I very much appreciate your time for reading this.

Use Variable To Run Goto And Play
I have a variable called 'randomclap' which is used to randomly choose a movie clip. This works fine, however I do not know how to tell it to play. Right now I am using this which is'nt working

_root.randomclap.gotoAndPlay("clap");

Any Ideas?

At The End Of One MoveClip Goto And Play Another.
Hello all,

This should be so simple. All I want to do is when one MovieClip finished, goto and play frame 2 of another movieclip. But I'm ahving no luck. Any help would be great.

Thanks L.

Goto And Play Nextframe?
ok dumb question
but i cant seem to find it either in the help file or in my book.

whats the syntax for having a button cause the playhead to go to and play the next frame

nextFrame(); stops the playhead

thanks

shoeshine

Goto And Play Scene
This is a really dumb question, and Im sorry for that, but when ever I try to make a button designated to take the user straigt to a scene, I use ''on (release) {gotoAndPlay(1,1);}'', and Its says that it must be a quoted string. What does this mean? and what is the proper syntax?

Play 10 Frames And Then Goto - How?
On frame 1 I need an action on a button that plays an animation during 10 frames and then goto another scen - without putting an action on frame 10. Only one button action. Possible?

Help With Goto And Play/stop
hi, ive got a simple game where the user controls a fly which runs away from spiders. as the spiders hit the fly a variable called score increments by 1. I have some code which should jump the player to scene 3 when the score variable goes over 50. Alas the game jumps straight to scene 3 as soon as the movie is run. Here is the code im guessing its a prob with the variable Score though:

score = 0;
//
onEnterFrame = function () {
scoreText.text = score;
};
onEnterFrame = function () {
if (Score >= 50){
gotoAndStop("Scene3",3");
} // end if
}

Goto And Play Problem
I have a short movie clip on my main time line with the instance name of logo1.
The clip has a stop action in the first frame and the animation begins on frame 2 which I have labeled "start"

In the first frame of my main time line I have an action:

Code:
this.logo1
gotoAndPlay("start");
The clip does not goto and play when the script runs however. Seems simple enough. I have tried goto and play frame 2 and still nothing.

Seems simple enough but I can't figure out what I am doing wrong. I would really appreciate any help.

Goto And Play Next Frame
Hello everyone,

How we say in actionscript goto and stop to the next frame
gotoAndStop(?)

Thanks

Button Goto And Play Help
Hey guys,

I need to have my button goto and play scene 3 and scene 5.
What code would I need to use for this?

so far I have:

on (release) {
gotoAndPlay ("Biography");
}

It would be amazing if someone could help,
Many thanks, Dylan

Goto And Play Won't Take Me Where Needed
hi, i have a flash animation which consits of images going up and down and text (done in cs4). it is for a website and i want the animation to continue playing where it left if the link on the page is changed (the animation is on every page) so i used this code:

import flash.net.SharedObject;
var mySo:SharedObject;

mySo = SharedObject.getLocal("lifebanner");
if (mySo.data.tst>1) {
this.gotoAndPlay(mySo.data.tst);
}


this.addEventListener(Event.ENTER_FRAME, onEnter);
function onEnter(e:Event):void {
mySo.data.tst = currentFrame;

}

it works fine with the 1st 240 frames, where there's 2 sets of text and 2 images. By works fine i mean if i switch it of and on again the animation doesn't start over but continues from where i switched it off. Now my problem is that on frame 240 is another image going up and if i close the movie anywhere after 240 it still starts at 240.

I checked the mySo.data.tst it works fine (picks up the number of frame) but for some reason it doesn't play it, just jumps back to 240.

Please help, Thanks.

Goto And Play Won't Take Me Where Needed
hi, i have a flash animation which consits of images going up and down and text (done in cs4). it is for a website and i want the animation to continue playing where it left if the link on the page is changed (the animation is on every page) so i used this code:

import flash.net.SharedObject;
var mySo:SharedObject;

mySo = SharedObject.getLocal("lifebanner");
if (mySo.data.tst>1) {
this.gotoAndPlay(mySo.data.tst);
}


this.addEventListener(Event.ENTER_FRAME, onEnter);
function onEnter(e:Event):void {
mySo.data.tst = currentFrame;

}

it works fine with the 1st 240 frames, where there's 2 sets of text and 2 images. By works fine i mean if i switch it of and on again the animation doesn't start over but continues from where i switched it off. Now my problem is that on frame 240 is another image going up and if i close the movie anywhere after 240 it still starts at 240.

I checked the mySo.data.tst it works fine (picks up the number of frame) but for some reason it doesn't play it, just jumps back to 240.

Please help, Thanks.

Using GoTo And Play In Flash MX
Why is it that the gotoAndPlay() command does not work when placed on the time line.

I am having all sorts of unpredictable results in flash MX somethimes it will work other times it wont. But it allways compiles????


Is it me of is flash MX deliberately cryptic.

Goto And Play Not Working?
I have a scene with an animation. at the end of scene I ahve an action thats says:
gotoAndPlay("2", 1);

But it doesn't skip to scene 2 and play?

It is a demo try out version from Macromedia?

Goto And Play Variable Set
I am trying to set the 'goto and play' function so that it will go back and start from frame 1 a set number of times before continuing to the next frame. How do I do this?

AS3 To Goto And Play First Frame Again?
I have 3 frames on my timeline. When the playhead reaches the last
frame, I want it to go back to the first frame and start playing again.

What is the AS for this?

Thanks!

Mouse Over Goto And Play.
i wanna do this thing dunno if its possible but on mouse over (mouse over mi button) i want this clip to play but i want it to play over the top so i dont lose mi button u get me?


on (release) {
getURL("main.html", "_self");
}
on (rollOver) {
gotoAndPlay("flare");
}


flare is the name of the layer and the instant name of the clip i want to play.

OnRelease Goto Play Mc1 THEN Mc2 THEN Mc3. Plz
Lets say I have ten buttons for different purpose and one main_mc(10 frames animation) and i want everytime when user click on any of these buttons first main_mc should play all 10 frames animation and then do what ever task i attached with the button. in a simple way Iam looking for "THEN" in flash, so i can write my code like:

onRelease gotoPlay mc_1 THEN gotoPlay mc_2 THEN loadMovie dream.swf at the level 10

//P.S.
//its my dream code, please make it real. I am simply not good enough

GoTo And Play Problem
heres my set up..

frames
| 1 |2 | 3
1| stop |movie 2 |
2| movie | |

movie>20 frames...
in teh last frame i tell it to goto "scene1",2
but i cant get it to goto that frame..
it just keep looping frame 1 of the main scene
ive tried everything..
ive also used a frame label with the same setup and didnt work..
i used to get this alot and i figure out y..
and ive tried without the scene 1

is there a solution...

Button: Play Then Goto
I have a flash video. I have 4 buttons. Id like after a button is clicked, that it play the next 15 frames, then forward to another part of the timeline. but each button needs to forward to a different part.

If there a way to have the script for the buttons to be something like this:

play next 15 frames, then gotoandplay 50
play next 15 frames, then gotoandplay 60
play next 15 frames, then gotoandplay 70
play next 15 frames, then gotoandplay 80

thanks.

On Touch Goto And Play?
How can I make it so that when an object touches another object the main scene will goto the next frame?

I already know how to make another object go to the next frame but I cant seem to figure out how to make the main scene do it o.O?

Help plz ?

Goto And Play Scene?
For some reason i'm having problems swapping scenes in my flash movie. At first i put the action in a "actions" named layer and a link to a button.

So basicly when scene1 loads the frame 1 action is "stop ();". The viewer clicks on button1 which has a code of ;

on (press) {
gotoAndPlay ("10");
}

At frame 10 a 15 frame animation plays and finishes at frame 25. Actions for frame 25 is (keyframed ofc) ;

gotoAndPlay ("scene2", 1);

which wont work. I tried _root.gotoandplay etc and even scene1.gotoandplay and stil wont work. Then i assigned the action to the button itself and just wanted to see if i could switch to the scene by clicking on the button. No it wont work.

I'm fairly (actualy VERY) new to flash, so i might be missing something essential. What is it?

Goto And Play Won't Take Me Where Needed
hi, i have a flash animation which consits of images going up and down and text (done in cs4). it is for a website and i want the animation to continue playing where it left if the link on the page is changed (the animation is on every page) so i used this code:

import flash.net.SharedObject;
var mySo:SharedObject;

mySo = SharedObject.getLocal("lifebanner");
if (mySo.data.tst>1) {
this.gotoAndPlay(mySo.data.tst);
}


this.addEventListener(Event.ENTER_FRAME, onEnter);
function onEnter(e:Event):void {
mySo.data.tst = currentFrame;

}

it works fine with the 1st 240 frames, where there's 2 sets of text and 2 images. By works fine i mean if i switch it of and on again the animation doesn't start over but continues from where i switched it off. Now my problem is that on frame 240 is another image going up and if i close the movie anywhere after 240 it still starts at 240.

I checked the mySo.data.tst it works fine (picks up the number of frame) but for some reason it doesn't play it, just jumps back to 240.

Please help, Thanks.

Mouse Over Goto And Play.
i wanna do this thing dunno if its possible but on mouse over (mouse over mi button) i want this clip to play but i want it to play over the top so i dont lose mi button u get me?


on (release) {
getURL("main.html", "_self");
}
on (rollOver) {
gotoAndPlay("flare");
}


flare is the name of the layer and the instant name of the clip i want to play.

MC Play Backwards + Goto ?
Hi experts!  

What I want to do is (what I've seen on a thousand flash-pages, but can't figure out how do to myself!) have each content-page of my homepage in seperate movie clips and control them with a menu movie clip. As I've done it so far is following:

Each movie clip (with content for each page) is placed in a seperate layer and in a seperate frame - first frame displays page with front page content, next frame displays the usual "About company", and so forth.

Each page-mc has a roll-down function, when the frame is entered, with following code:

onClipEvent (enterFrame) {
if (this._currentframe<this._totalframes) {
nextFrame();
}}

This works fine. The problem is that I want it to "roll back up" (play the movie clip backward) when I click the menu to enter another page - that is, just before I enter the next page, naturally. That, of course, presents the problem, that the content of the next page covers the rewinding content of this page, so I can't see it, even I figure out how to rewind it.
So, you see, several problems in one... I'm getting lost here.

I've tried the usual prevFrame code with several code snippets to play the mc backward, but the problem is, right now I don't even know how to handle the organizing of the movie clip pages, so they don't cover eath other.

I've fiddled with the idea of whether it's possible to first rewind the ongoing content movie clip, and then jump to another frame (with another mc) by the click of a button in a third mc (the menu mc). If this is possible, I think this would solve it all.

Please advise. My deadline has passed!

Goto And Play On Collision
i have a simple game where a cat moves through a building via quantum tunneling (through walls and floors).  I want the movie to go to a little losing sequence when the cat collides with a of several dogs positioned throughout the buildings.  can anyone help me?

also, is there a way to exclude the cat from the loop the dogs are already on.  I mean, right now, i have to make the movie longer or otherwise the cat will start at the beginning of the game at the end of each loop.  i want the cat to move freely through a building unless it collides with a dog.  can it really be that hard?

How To Unload Then Goto&play?
I have two movie clips one inside another. lets name them MC-A & MC-B.

I have MC-B INSIDE MC-A. got it? Inside MC-B there is a button, I want it to be like that. on the click of the button in MC-B, it goes to MC-A and play frame 5.

I have been tryin & tryin... but didn't work.. hope someone who is better can help...

Copyright Đ 2005-08 www.BigResource.com, All rights reserved