View Full Version : Performing multiple functions with just one trigger...
mlkedave
January 18th, 2004, 07:40 PM
Sorry if the subject doesn't make much sense but I basically want to perform several if the statement when on movie clip is clicked.
Can someone please give me an example of an onRelease trigger that activates two if then statement that change the frames of 2 movie clips. Thank you very much.
Mike
GreenLantern
January 19th, 2004, 12:08 AM
I don't quite understand what you are getting at here.......
on(whatever){
if(something == true) {
clip1.gotoAndPlay(2);
}else{
clip2.gotoAndPlay(2);
}
Something like that?
mlkedave
January 19th, 2004, 12:12 AM
Well yes but instead of else i want and... is that possible. I want to actions to happen from one trigger...
lunatic
January 19th, 2004, 12:18 AM
like this?
on(whatever){
if(something == true) {
clip1.gotoAndPlay(2);
}else if(somethingelse == true) {
clip2.gotoAndPlay(2);
}else if(yetsomethingelse == true) {
clip3.gotoAndPlay(2);
}else (somethingelseentirely);
}
APDesign
January 19th, 2004, 12:49 AM
I think you just want this (just a basic if statement????)
on(press) { // or whatever.
if(yourCondition == true){
clip1.gotoAndPlay(3);
clip2.gotoAndStop(6);
clip3.removeMovieClip();
trace("Whatever else you want");
} else {
// do whatever
}
}
mlkedave
January 19th, 2004, 01:03 AM
Not else, I want to perform 2 function at the same time. Can I replace "else" with "and"? Will that work?
I want to be able to have 2 conditions... Do i just put another if then statement with the same trigger?
APDesign: what does "trace ("Whatever else you want")'; " mean?
GreenLantern
January 19th, 2004, 01:11 AM
trace sends a message to the output window. It's kind of like "echo"
I think APDesign covered what you are trying to do.
Do you have a fla you can post?
mlkedave
January 19th, 2004, 01:54 AM
No not really... I just want to make it so I can have something to the effect of "on release : if movieclip one is on frame 1, movieclip2 goto and play frame 2 and if movieclip 5 is on frame 4 movieclip 6 goto and play frame 2" I just used random movieclip names but I basically want multiple conditions and mutiple respons on one trigger. Give you put my noob talk into an AS format? Thanks for being so patient with me. I still really have no clue what the trace thing means... or what echo means... Can you try to explain it in lamans terms ... lol thanks...
mike
GreenLantern
January 19th, 2004, 03:33 AM
Sounds like a job for...............(cue superhero music) SWITCH BLOCK
Try this:
switch (yourmovieclip._frame) {
case 1:
trace ("Frame 1"); break ;
case 2:
trace ("Frame 2"); break ;
case 4:
trace ("Frame 3"); break ;
case 8:
trace ("Frame 4"); break ;
default:
trace ("Not on frame 1, 2, 3, or 4") ;
}
Your won't be able to use different movie clips with this, but you could set up multiple switch blocks, each refering to a different movieclip.
For more information on the switch block try this:
http://www.kirupa.com/developer/actionscript/switchcase.htm
mlkedave
January 19th, 2004, 11:29 AM
Even you think that will work im sure you are right, the only problem is i have NO CLUE what that means. I mean when I was into VB i worked with cases but I have no clue where to put conditions and triggers in the AS... can you format that so when i release a button, one moviecliip is on frame1 then movieclip2 goes to frame 2 and movieclip3 goes to frame 3 and if movieclip10 is on frame 1 then movieclip11 goes to frame2. You know what i mean? just plug in any examples so i can try to figure it out. (where two conditions and different results of these conditions occur from one trigger). Thanks for being a nice redmirrorball. Your a nice guro!
GreenLantern
January 19th, 2004, 11:32 AM
I have no idea why you would want to do that.
Post your fla.
mlkedave
January 19th, 2004, 11:59 AM
Well i dont have the layout in flash yet, (still in photoshop phase). The reason I want to do this is I want one menu button to, on release, change its frame, (to show that it had been pressed) and I want a picture to change when it is release, and I want the page to change when its released. I know this sounds like a lot but it would be that wouldn't be much if i could put multiple if then statements or gotoAndPlay statments on the same trigger. I basically want to know if it is possible to have to things happen off of one trigger by just repeating the same code and changing the condition and effect and if this doesn't work, i need to know a method. Thanks redball
mike
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.