Tuesday, November 25, 2008

Adding NAVIGATION

At first I thought this was actually really easy compared to drawing in flash. After I had the two codes correct I just put in the desired button and frame into the code. The only thing that gave me any trouble was trying to figure out what made my 'previous' button go back. I tried the words last, earlier, previous, and before. It was not until I noticed blue appeared on 'prev' as I was backspacing it before I realized what I should put in.

Then I learned that my 'back to start' button didn't work correctly. I tried everything!!! I made another layer, copied the button to the rectangle layer, locked/unlocked layers, added 'stop ();' to every rectangle, copied the start button frame multiple times, added 'stop ();' to the start button frames, and I learned that 'GotoAndStop' doesn't work for snot. I can't get it to work!!!!!!

I'm typing this on a different day from the above paragraphs. I emailed my professor and he responded to this blog with some great advice. Before I checked I figured it out. I needed a 1 between the () after GotoAndStop. That is a really silly error, but I'm past that and am on to another project.

P.S. I was so tired when I first wrote this post that I save it as Adding Animation when it should have been Adding Navigation

1 comment:

Patrick said...

Trevor,
nextFrame and prevFrame will traverse you back and forth, but if you have animations that run for multiple frames, this will not work. Instead, give the keyframes at the start of your animation label by clicking on the keyframes and filling in the label name down in properties. Also, make sure that you have given your button an instance name on the stage as well. If you have these two things accomplished, you should be able to make code such as this....

Button_instance_name.onRelease = function() {
gotoAndPlay("frame_label_name"); }

Here is the kicker, if you plan on using the same two buttons, or in your case, same three buttons of Back, Forward, and Return to Beginning in each section of your animation you need to have a new keyframe that starts the code that affects those buttons at that time, as well as a keyframe for instances of those buttons. The reason for this is that your Next Button throughout the movie will gotoAndPlay or gotoAndStop various frames. The only button that will allows reference the same frame is the "Return to the Beginning" button. Lastly, if you have named your button name something that you think may be a reserved word in Flash, go to your Actions pane, and try to type in the proposed name for the button. If the name turns blue, then you know that this is a name that cannot used, because Flash is already using that name for a different purpose. I hope this helps! Lastly, you may check out my tutorial on my wiki page on creating movie-clip like buttons if you have additional difficulties. Email if you still have trouble!