Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie problem with flash actionscript...

Status
Not open for further replies.

jjfletch

Technical User
Sep 4, 2004
13
US
Hi,

I just started using Flash within the past week and I'm having some confusion issues here...

I have a movie that uses animated buttons for navigation. I'm trying to get the button to stay in a "mousedown" state once the user visits that page. I've been reading stuff re: setting variables in html code, etc., and have tried a variety of codes, but I think I'm misunderstanding something somewhere, because I can't get it to work....

My last attempt involved setting a variable in my html code and then trying to get Flash to check for it, but that didn't seem to work. I've read (a lot) about FlashVars and tried some solutions based on that, but I've been unsuccessful in my attempts...

<a href=" flash file is located here</a> and if someone could take a look at it and let me know if they're able to get it to work, and how, I will totally appreciate it. I know I'm doing something wrong, but I just can't figure out what it is...
 
You are having trouble because you can't do that with a button instance. What you should do is make your "button" a "movieclip" instead. That will give you more freedom for coding it to do what you want just using gotoAndStop(frameNumber).

Hope that helps.

Wow JT that almost looked like you knew what you were doing!
 
You need to do two things:

1. Pass the HTML page information to the SWF, so that the SWF knows it is in "index-1.htm" for example.

2. Tell the menu button MovieClip to gotoAndStop at the specific frame. For example if the location is "index-1.htm", tell the menu MC 1 to gotoAndStop at frame 11.

The 1st task can be achieved using numerous ways but since you're familiar with FlashVars why don't you use that. The FlashVar can be as simple as "page=1", for example.

For the 2nd task, you have to write a simple script, but first you have to name the menu MCs: let's call it "mcMenu1", "mcMenu2", etc for now.
(Make sure you give the same name to the MC's at all the key frames.)

Then put the following script in the root timeline:
[tt]//
this["mcMenu"+page].gotoAndStop(11);
//[/tt]

If "page" is "1", the above script tells mcMenu1 to gotoAndStop at 11.

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top