Jump to content


Photo

Trying to use gotoAndStop()


  • Please log in to reply
12 replies to this topic

#1 herocks

herocks

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 25 November 2006 - 08:36 PM

Ok so i want to make it so when i click on a button it goes to a scene called scene 3
when i use this code
on
(press)
{
gotoAndStop("scene 3");
}

Nothing happens when i click on the button.... Can anyone help?

Edited by herocks, 25 November 2006 - 08:37 PM.


#2 Tromac

Tromac

    Young Padawan

  • Members
  • Pip
  • 56 posts

Posted 25 November 2006 - 09:28 PM

When flash movies are published, the scenes are all placed one after the other and put together in one long movie. So, there are no "scenes" when a flash file is published, and hence you cannot make a reference to scene names in Actionscript. Scenes are only in flash files to help keep things organized.

What you need to do is create a frame label on the first frame of scene 3 by selecting the frame in the time line, and labeling it in the properties panel. You can then use your Actionscript code to refer to that frame by using it's label.

For example, if you label the keyframe "Scene 3":
on (release) {
	gotoAndStop("Scene 3");
}

Hope that helps :)

#3 UnderAttak

UnderAttak

    Young Padawan

  • Members
  • Pip
  • 57 posts
  • Gender:Male
  • Location:San Diego

Posted 27 November 2006 - 03:29 AM

When flash movies are published, the scenes are all placed one after the other and put together in one long movie. So, there are no "scenes" when a flash file is published, and hence you cannot make a reference to scene names in Actionscript. Scenes are only in flash files to help keep things organized.

What you need to do is create a frame label on the first frame of scene 3 by selecting the frame in the time line, and labeling it in the properties panel. You can then use your Actionscript code to refer to that frame by using it's label.

For example, if you label the keyframe "Scene 3":

on (release) {
	gotoAndStop("Scene 3");
}

Hope that helps :ph34r:

you actually CAN navigate through the scenes you've created using actionscript.

First, name your button instance. Then enter this code in it's own layer:

instancenamehere.onRelease = function() {
gotoAndStop("Scene Name Here");
}

Scenes do help keep things organized a LOT, but it is also used for navigating for complicated projects. Say bye-bye to long and confusing timelines. You can setup one scene to be your master animation (the kind used all the time) and have other scenes gotoAndPlay this scene, then at the end of the master scene there is another script that goes back to wherever you want. That way, the motion tweened frames of your master animation won't have to be placed over and over again in each scene.

Edited by UnderAttak, 27 November 2006 - 03:29 AM.


#4 wm.AngelEyes

wm.AngelEyes

    Jedi In Training

  • Members
  • PipPip
  • 452 posts
  • Gender:Male
  • Location:Denmark

Posted 27 November 2006 - 05:23 AM

Why Use Scenes..

I never use them Why Not Load in level's ??..

Much easyer i think..

But why Use Scenes ?

Angel eyes

#5 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 27 November 2006 - 05:26 AM

tbh.. I also never used scenes.. I rather build single mc's and put them all together on only one timeline. and then control them via AS.
Scenes are definately there for animators..

#6 UnderAttak

UnderAttak

    Young Padawan

  • Members
  • Pip
  • 57 posts
  • Gender:Male
  • Location:San Diego

Posted 27 November 2006 - 05:58 PM

I use a lot of animations as well in my projects, most which are built in AE in seperate FLV files and linked together afterwards in Flash, and I usually use scenes only if it'll be beneficial in my project IE I have certain actions/animations that are repetitive between link transitions or things like that. That way, all I have to do is load that certain scene after one scene is done. I just find myself working better with scenes when organizing, I hate working with long timelines.

It also helps with web flash files to treat a scene as a page in itself. When you finish one scene and treat it as a template, all you have to do is copy the scene and rename it to a new page, and change your heading, content, etc. This usually works with simple, repetitive web pages though. Something a bit more complicated involving more complex rollover buttons and content will require more to change within each scene, but then you lose the whole continuity factor with your page anyway.

#7 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 28 November 2006 - 06:32 PM

Actually all (professional) Flash sites are created within a couple of frames, and then animated within hundreds of movieclips. I've never seen a site that linked to different scenes, that would be stupid.

But I do see your point on the animation part. It's just that there are sound issues aswell that I never touched on. Say you wanted a backing track to last the whole animation. Well, for scenes, you cant stream them (unless you cut your song up into peices and put them on each scene, but thats pretty stupid). And dont think scenes are the only way to organise an animation. Movieclips can store animations, and even Graphics, which I use a lot, when doing animations.

Ben

#8 UnderAttak

UnderAttak

    Young Padawan

  • Members
  • Pip
  • 57 posts
  • Gender:Male
  • Location:San Diego

Posted 29 November 2006 - 12:26 AM

Movie clips are the way to go, can't argue with that.

But if you load a scene with a looping sound, say a looping track as your bg music or effects or whatever, it will continue into the next scene that you load until it finds some script that stops the sound. Even if you have some sort of media player on your page that loads external mp3 files to play, it will continue to play within different scenes seamlessly unless stopped or paused. At least that's what I've experienced so far.

#9 wm.AngelEyes

wm.AngelEyes

    Jedi In Training

  • Members
  • PipPip
  • 452 posts
  • Gender:Male
  • Location:Denmark

Posted 29 November 2006 - 02:40 AM

I don't understand the use of graphic tweens i never use them, i think building ALL up in mc's so you get rid of the graphic tweens, plz explain to me if it's usefull to use grapich tweens

#10 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 29 November 2006 - 02:44 AM

I think they're more full proof, because shape tweens (and you mean motion tweens, not graphic tweens) are weird and unpredictable. Shape tweens are only good for transition in shape and colour. Motion tweens are good for motion.

#11 wm.AngelEyes

wm.AngelEyes

    Jedi In Training

  • Members
  • PipPip
  • 452 posts
  • Gender:Male
  • Location:Denmark

Posted 29 November 2006 - 04:00 AM

I think they're more full proof, because shape tweens (and you mean motion tweens, not graphic tweens) are weird and unpredictable. Shape tweens are only good for transition in shape and colour. Motion tweens are good for motion.


No i mean Shape Tween's, Exsampel if you make an animation of a shape ( if you forget to make an Mc )
You get those damn graphic tweens in your library.. But if you go down to your property box and select shape tween they don't come.. but i just dont see why you don't use movie clips you can do exactly the same ??

#12 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 29 November 2006 - 04:34 AM

I kind of dont really understand what you mean. They're made graphics so that they can be compatible with the motion tween.

#13 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 29 November 2006 - 07:56 AM

a shape tween is not a motion tween.. if you motion tween a shape (eg. not a graphic or mc symbol) the graphic tweens will show up in the library.

Simply convert your shapes/imported images to symbols!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users