Solved

Making a flash button do two things at once.

Posted on 2008-06-19
18
379 Views
Last Modified: 2013-12-24
I am trying to get a button inside a movie to start another movie and then also goto a certain frame on the _root movie.  I am not having any luck getting this to work.  I am working on the website www.designplaninc.com  I have setup the menu buttons so that when you move your mouse into a certain area that the menu box expands and when you move out the menu box collapses.  But the problem is that when you scroll out of the area to fast it doesn't catch it.  So I wanted to add code to a button that minimized the menu box when it also goes to the frame that you have selected.  Here is the code I am using
on (release) {
      _root.menubar.gotoAndPlay(15);
}

on (release) {
                     _root.gotoandPlay(56);
}

It doesn't see to do anything with the first item and scips down to the _root.gotoandPlay (56)

Any help would be appreciated..

THANKS
0
Comment
Question by:ScottH0221
  • 9
  • 8
18 Comments
 
LVL 13

Expert Comment

by:crooksy88
ID: 21822388
on (release) {
_root.menubar.gotoAndPlay(15);
_root.gotoandPlay(56);
}
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21822397
spotted the lowercase A in your code. It should be:

on (release) {
_root.menubar.gotoAndPlay(15);
_root.gotoAndPlay(56);
}
0
 

Author Comment

by:ScottH0221
ID: 21822452
No still not working it won't even goto frame 56 now when you put them together.  menubar is the movie clip name is that how it's supposed to be listed?
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21822659
Is it the movieclip instance name? i.e. added to the properties panel?

See the attached file for a working example. download the file and change the .txt to .fla.
The code above is correct.



Untitled-2.txt
0
 

Author Comment

by:ScottH0221
ID: 21823005
ok adding the instance name worked but...

it does the first line but doesn't do the the second

on (release) {
      _root.menubar.gotoAndPlay(16);
      _root.gotoAndPlay(568);
}
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21823483
Have you tried running the example I have supplied? This does both commands.

Have you get 568 frames on the root?
0
 

Author Comment

by:ScottH0221
ID: 21823580
i couldn't open the attachment are you working on a mac?
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21823622
Yes but that shouldn't be an issue. Have you got Flash CS3 or Flash 8?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ScottH0221
ID: 21823753
Let me add something...  What I have is a movie inside a movie.  I have a menubar accross the top that acts as a movie and one of the buttons has a submenu which is in another movie and that is where my button is that I am trying to get it to do the action.
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21823848
I'm sure your problems lie with targeting the movieclips correctly.

You can try this: Select a movieclip and add this code to it. Then test the movie.

on clipEvent(load) {
trace(this._target);
}

This will output the path to the movieclip.

Alternatively you can attached the file and I'll take a look.
0
 

Author Comment

by:ScottH0221
ID: 21823914
i can't send the .fla file is 40 meg....   Don't suppose there is a different way to get to you?  Also do I need to change any of the on clipevent code to label the movie?
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21824008
No, as long as you select the movieclip on the timeline, then paste the code into the actions panel it will work.

How about zipping the file up and posting it on your website, then send me  a link to it so I can download it.
0
 

Author Comment

by:ScottH0221
ID: 21824065
0
 

Author Comment

by:ScottH0221
ID: 21824345
should probably let you know that the menu bar across is a movie with submenu which is also a movie inside of it.  Let me know if you were able to download
0
 
LVL 13

Expert Comment

by:crooksy88
ID: 21824781
OK I've downloaded the file but I can't see anywhere that you are trying to do two gotoAndPlay's at once?
0
 

Author Comment

by:ScottH0221
ID: 21824869
well if you goto the subbuttons movie and then goto the argosy casino hotel and spa button.  I had...
on (release) {
      _root.menubar.gotoAndPlay(16);
      _root.gotoAndPlay(568);
}

try pasteing that there and you will see what I mean..
0
 
LVL 13

Accepted Solution

by:
crooksy88 earned 500 total points
ID: 21825006
I think the problems lie with how you have created the entire movie and unfortunately I can't make sense of what is going on.

Going back to your initial question, the code I supplied does do what you ask, it's just that you have other commands being played all over the timeline so it's extremely difficult to pinpoint the reason why the timeline isn't doing what you want it to.

My suggestion would be that you make a copy of your file, then work on the copy, remove the menu bar altogether, then slowly build it back up, working with simple buttons. Only when you have it working as you want should you look into animating it.

Sorry I can't help any more.

Mark

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

706 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

14 Experts available now in Live!

Get 1:1 Help Now