Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to create a simple static menu in flash

Posted on 2010-09-18
8
Medium Priority
?
233 Views
Last Modified: 2012-08-13
Hi,

I am working with sixth form students and have been asked to cover Flash at laste notice and I have never used this program/environment myself and have found many tutorial useful for the basics like tweening and simple movements however I am having trouble adding the interactivity, such as buttons to click that will load a different layer/time/flash file. I have manage to draw a button and have some code that on click it will jump to frame x (100 etc). Anything more complex seams to just fail for me.

What I need now is a static menu i.e. 5 buttons on the left and different ‘pages’ to load when they are clicked and through an intensive search and many tutorials I still cant get any to work. Basically  I am needed to create a small ‘website’ of five pages of information and due to the course we have to use flash not Dreamweaver. Please can I ask that the solution is as simple as possible 1 for me and 2 for my students as they have never used Flash either. Is there anyway for this to be done without action script or with as little as possible?

Also I don’t know how to keep the buttons or information on screen indefinitely - until the user clicks another button.

Any further information/clarification needed please don’t hesitate to ask.

Many thanks for any help you can provide it will be much appreciated by me and the students.
0
Comment
Question by:Karl01
  • 5
  • 3
8 Comments
 
LVL 7

Accepted Solution

by:
AreDubya earned 2000 total points
ID: 33710029
Karl01,

This is a simple example that uses the timeline. You will notice that the "pages" are MovieClips, which means they have their own internal timelines, so you can add animation and assets specific to each page.

I would embrace the ActionScript. Maybe check out Colin Moock's Lost AS3 Weekend with the class?
And when in doubt, highlight something and hit F1.

AreDubya
menu.fla
0
 

Author Comment

by:Karl01
ID: 33710144
AreDubya,

That’s a great clear example for me to use. However I have just tried to figure out how it all works, so if I could ask a few follow up questions if you don’t mind that would be great.

I have tried to step through and recreate your example to learn but have already encountered a problem. The text buttons are static on screen by using the convert to ‘movie clip’ option rather than the button option as I had been trying, but when I add the pages and run the clip they just cycle through really fast as if they are still part of the normal timeline, I have drawn them on the content layer and selected F8 to convert them to a movie clip on each keyframe on frame 1-5 am I missing a step?

Also I have changed some of the code to suit my variable names (I think) and I have been given and error for each button here are the details:

1120: Access of undefined property Btn1.  
Btn1.addEventListener(MouseEvent.MOUSE_DOWN, getPage1);

Also what is meant by the word ‘void’ at the end of each function?  I am going through tutorials and book but due to the time constraints and specific criteria I have to work to, its a frustratingly slow process.

Thank you very much for your help. I will of course award the points for the initial answer but not sure if I do that now will that stop us being able to discuss this further?

Best regards
Karl
0
 
LVL 7

Expert Comment

by:AreDubya
ID: 33710174
Karl01,

Glad it's helpful. I am not sure what you mean by "static on screen", I am assuming just that they don't disappear. This is the sequence to create the buttons:

Make a text box w/ text.
Convert that to a MovieClip.
Add it to the stage on frame one.
On the same layer, insert a frame at the end of the movie - not a key frame.
The button will now be on stage for the entire time.

To get rid of cycling:

Make sure you have stop(); at the top of the first frame, it will hold the playhead there.

The 1120 Error:
Not sure without a file. You are trying to get to something with an instance name Btn1 inside of something named Btn1? If you just changed the name(maybe a bad call for the students, sorry ; )), then you should use:

Btn1.addEventLIstener(MouseEvent.MOUSE_DOWN, getPage1);

Also, you have to change the instance names - select the button and make sure the name is Btn1 on the properties panel.

Void at the end of a function means the function won't return anything. If the function returned something you would change that to Number, String, whatever the function returns.

Paste the code below into a new fla, when you click the stage it traces a random # bet 0 - 10. You can see how the return is used.

Good Luck,

AreDubya
import flash.events.MouseEvent;

var test:Number;

test = getNumber();

function getNumber():Number
{
	return(Math.random() * 10);
}

function traceTest(e:MouseEvent):void
{
	test = getNumber();
	trace(test);
}
stage.addEventListener(MouseEvent.MOUSE_DOWN, traceTest);

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Expert Comment

by:AreDubya
ID: 33710189
Also, check out tv.adobe.com - really good tutorials on both the Flash IDE and ActionScript.

AreDubya
0
 
LVL 7

Expert Comment

by:AreDubya
ID: 33711653
Karl01,

One other great site for tutorials - gotoandlearn.com . Can you close this thread if I have answered your question? Thanks,

AreDubya
0
 

Author Comment

by:Karl01
ID: 33711754
Hi AreDubya,

It was the instance name that was missing from the button text and that stopped the ‘page’ boxed cycling through like a rave light.

Great spot on the reason for the name change; although a bit of humour could help them remember the procedure better I won’t risk it with a new class just yet.

I will check out the two reference sites you have provided however I think I will be back here before long.

Thank you for your effort and the work you put in, it is greatly appreciated.

Karl
0
 

Author Closing Comment

by:Karl01
ID: 33711761
Very helpful.
0
 
LVL 7

Expert Comment

by:AreDubya
ID: 33712064
Glad to help, I will keep an eye out for you!

AreDubya
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month9 days, 12 hours left to enroll

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question