Solved

How to create a simple static menu in flash

Posted on 2010-09-18
8
225 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 500 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

919 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now