Solved

How to create a simple static menu in flash

Posted on 2010-09-18
8
224 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

760 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

21 Experts available now in Live!

Get 1:1 Help Now