Solved

How to create a simple static menu in flash

Posted on 2010-09-18
8
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
YouTube Link 10 368
Google Chrome - Where is "Enable Resource Tracking" 2 12,415
private function works only without TabNavigator? 3 322
Create animated movies for web page 18 119
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

735 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