FORUMS: list search recent posts

Beginner needing help

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jennifer Landry
Beginner needing help
on Jun 12, 2009 at 12:34:11 pm

So I used a tutorial to start developing a flash navigation bar for a website I'm creating ( but it kind of leaves me hanging. I've been trying to find answers to my questions without asking, but I didn't find people having the same EXACT problem as me.

The tutorial describes how to make the buttons using movie clips and button behaviors. My navigation bar I created in Photoshop has four main buttons, and a variety of buttons that drop down from it. I used the same technique in the tutorial for each. But now I need to figure out how to put links in each button.

And, if you can answer that question, I have another.

I'm not sure how to actually put this new navigation bar into a website. I've been browsing google for a good half an hour now (time is a little limited in the morning) and I can't seem to find a solution.

If anyone could point me in the right direction on how to figure this out, it would be greatly appreciated. If you can't tell, I'm rather new at this, and I have some free time on my hands, so I wanted to try this out.

Oh, by the way. I'm using Adobe Flash CS3 and ActionScript 3.0 (i just now learned through browsing around here, AS3 must be harder or something -_-).

Thank you SO much! ♥

Return to posts index

Pieter Helsen
Re: Beginner needing help
on Jun 14, 2009 at 10:22:44 am

AS3 is more structured, not necessarily harder :)

Anyhoodles. There are three things that are common when assigning button behaviour to your buttons/movieclips.

First of, you need to set the behaviour of the movieclip (this doesn't apply to buttons):

my_mc.buttonMode = true; // among other things, makes your movieclip show a hand cursor when moving over it with your mouse
my_mc.mouseEnabled = true; // allows for the movieclip to be clickable
my_mc.mouseChildren = false; // makes the movieclip as a whole clickable, not just the children that are inside the movieclip

Second thing to do is to add event listeners. Event listeners do just what you would suspect, they listen to an event and then react to that event. There are three common events that you will use often, these are CLICK, ROLL_OUT and ROLL_OVER

my_mc.addEventListener(MouseEvent.CLICK, clickHandler);
my_mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);
my_mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);

So this button will now react if you move your mouse on or off the button/movieclip by executing the code in the event handler (clickHandler, outHandler, overHandler). This event handlers are just functions that take a parameter, so we have to write those next:

function clickHandler(evt:MouseEvent):void {
// This code is executed when you click the button
// This particular code opens google in a new browser window or tab.
var url:String = "";
var req:URLRequest = new URLRequest(url);

navigateToURL(url, "_blank");

function overHandler(evt:MouseEvent):void {
// do stuff on roll over

function outHandler(evt:MouseEvent):void {
// do stuff on roll out

Kind regards,

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved