View Full Version : Click more then once on a button
saltysally
11-07-2008, 11:59 PM
Hello, I am trying to have many actions on one button. So you can click it once it goes to a frame then again it goes to another frame.
on (release) {
gotoAndStop(1350);
}
on (release) {
gotoAndStop(2610);
}
Medyman
11-08-2008, 03:12 PM
If it's just two, you can do something like this:
var clicked:Boolean = false;
button.onRelease = function() {
if(clicked == true) {
gotoAndStop(1350);
}
else {
gotoAndStop(2610)
}
}
Is it just two actions? Or are there more?
saltysally
11-10-2008, 08:49 PM
Their is many I have fore buttons that are suppose to go to frames on the timeline. Then about six buttons that attach a MC to the stage then on the next click I need them to play the nextframe in the MC.
on (release) {
this.canvas6_mc.attachMovie("hair","hairforward_btn",36);
}
This is what is on the MC's
var frame_arr:Array=[1,1350,2190];
var c3:Number=0;
function frameCount3():Void{
gotoAndStop(frame_arr[c3]);
c3++;
};
bodyForward_btn.onPress=function(){
// Calls the function defined above...
frameCount3();
};
This is the script for the timeline which is in the actions layer on the timeline. I have more than one button that will need to work the timeline, so my problem is that I can't reuse this script for each button. Did that make sense I hope so.:confused::confused:
BLiZZaRD
11-11-2008, 02:42 PM
I think I understand what you are doing here. By the names of your buttons I am guessing you have a character and are adding things to him/her like hair, clothes, etc.. Like a Flash paper doll. You want to click a button to add a hair-do to the doll and then continue to click the button to change the hair-do over and over.
There are ways to do this with more than 2 options as Medy has suggested, but I ask this... is single tap button the best way for your movie? It is possible, but I bet there is a better way. It would depend on the entire movie set up. If you care to share the .fla or more detailed information I (or Medy) can offer even more suggestions.
saltysally
11-11-2008, 07:37 PM
Here is a link to my fla file.
http://rapidshare.com/files/162840844/boocrew5.fla.html
Thank you for all your help.
BLiZZaRD
11-11-2008, 09:01 PM
I will download and have a look in a few hours when I get home. will let you know something tonight. :D
saltysally
11-11-2008, 09:44 PM
Thank you
BLiZZaRD
11-12-2008, 02:26 PM
Okay, I was correct. Now a few things to know... is this going to be part of a larger movie or is it just dress up and export?
I think you would be better suited here with single frame, multi-MC with external AS here. There is no need to have 1500+ frames.
I will work on an example over the next little bit (if you have the time to wait) but knowing the larger scale of the project will help the direction that goes.
of course you can always change the attachMovie to on(press) and then have the on(release) be the mc._currentframe += 1; code. ;) You will just need a place holder in Frame one of each item (hair, body, etc) because as soon as they press and release it will jump to frame 2.
saltysally
11-12-2008, 04:06 PM
Thank you for taking the time to look at my project and help me out I will do the on(press)/on(release) thing today. But today is my last day to work I will have to deliver the project tomorrow morning.
BLiZZaRD
11-12-2008, 04:13 PM
okay so tell me about the entire project. What is it supposed to do, how should it work, end result, etc...
Medyman
11-12-2008, 05:35 PM
1500+ frames.
Ouch. I don't mean this in any kind of snide or demeaning way...but that's really too much. The performance of your movie is probably not optimal (to put it nicely).
I guess it's too late for this project, but you probably spend some time and learn about some efficiency measures you can take through dynamic actionscripting.
Especially if this is client work (i.e. you're getting paid for it).
BLiZZaRD
11-12-2008, 07:47 PM
yeah, I was surprised to see as well. it seems mostly to be the stretched background layer, like the OP was pre planning to go out that far and wanted the background there in case.
I am working on a single frame method, if not to help with the timing of this project then at least as a useful tool for the future.
saltysally
11-12-2008, 11:45 PM
My project is suppose to have the user pick out of three body types, then the head they will pick, nose,eyes,lips,ears well you get the idea. Each time they choose one they are able to color each item they choose. Since the body styles are so different I have put the choices of body, head, and cloths on the timeline because their is certain cloths for each body style. My problem is the nose, eyes,eyebrows,hats,lips are in movieclips I could not put it all on the timeline for each choice. So I have them attaching to the timeline with a click of the button but the movie clips have frames in them I can't get my button thats on the timeline to be able to be clicked and go to the nextframe in the MC. I tried the on press on release and it's not working. Any ideas?
Medyman
11-17-2008, 01:52 PM
How did this turn out?
BLiZZaRD
11-18-2008, 01:36 PM
Not well. Did you have a look at the posted file? You are much better at cleaning up code than I am (I just tend to start over from scratch) :D
Medyman
11-18-2008, 04:04 PM
Not well. Did you have a look at the posted file? You are much better at cleaning up code than I am (I just tend to start over from scratch) :D
No... I didn't. The 1500+ frames scared me. From the sounds of it, I probably would have taken the start from scratch approach too. It's probably faster.
Does the OP still need help with this?
BLiZZaRD
11-19-2008, 06:00 AM
Dunno.. haven't heard back...
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.