Hey guys,

Having problems on the coding side of what I thought would be a very simple
task.

The task is:

I am creating a navigation bar for a website. On the navigation bar, when
the user does a mouse over on a certain area of the bar (invisible button),
a specified movie will play once and will not play again unless the user
does a mouse over again. When the user clicks on the invisible button, it
will perform the action of a link and direct the user to another page.

In a bit more detail:

In flash I have created a document (actionscript 3.0). On the document for
this example, there is a piece of text called labelled 'home'. This text has
been converted into a movieclip labelled home_mc. Inside the movie clip
there are 7 frames. Frame1 = home font size20 | Frame2 = home font size21 |
Frame3 = home font size22 | Frame 4 = home font size23 | Frame 5 = home font
size 22 | Frame6 = home font size21 | Frame7 = home font size20. As you can
probably tell, I am trying to make a growing text effect in flash.

Coming out of the movieclip to Scene 1 I have created another layer called
invivisible button1. This has then been converted to a button called
home_btn and made 'invisible'.

What I have been trying to do with actionscript is make the movieclip
home_mc play once when there is a mouse over event with home_btn (invisible
button), but with all the code I have tried so far nothing has really worked
and when I test the movie, the movieclip home_mc is just constantly playing
and looping back on itself.

The latest code I have tried is:

**Start code**

var home_mc:MovieClip = new MovieClip ();
//home_mc = someClip you embedded;
text_mc.name = "myButton";

home_mc.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
home_mc.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
//adds event listeners



funtion mouseOver (event:MouseEvent):void
{
    trace (event.currentTarget.name + "mouse over");
    // the trace event is asking for the name property (which is like a
method) we set that property above.
    //otherwise tracing event.currentTarget just tells us the type of object
we are dealing with = MovieClip
    event.currentTarget.play();
    //this function can be used on ANY subject that has an event handler -
addEventListener
}

funtion mouseOut (event:MouseEvent):void
{
    trace (event.currentTarget.name + "mouse out");
    event.currentTarget.gotoandstop(1);
}

**end code**

I have had some vague help previously and have read and looked at
tutorials/books but still don't quite get this. I am after all trying to
learn a new programming language without any previous experience with
programming languages.

Any help with this hopefully simple problem would be gratefully appreciated.

Thanks,
Ali Hitch
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to