|
-
scripting cramp!
Hi! I'm kind of a newbie and I am doing a website for a custom parade float company. So in my site when a user clicks on the initial "start parade" button it brings a parade float across the screen and it stops in the middle where I will load a movie of the home information. This will happen for every navigation button that the user clicks on(a different float for every button). I am wanting to do some code so that when I click on another navigation button the current float on the screen will pull away and the proper float will come in behind it like a parade. I am having trouble figuring out code on how to do this. If anyone could help I would be so appreciative!
chris
-
Bearded (M|G)od
you need to set up a _root.goTo variable. when the navigation button is clicked, the animation for the float going away is played and _root.goTo is set to whatever the next page is, ie: _root.goTo = 'page2'; , after if it is done, there is a switch statement for the different pages/floats and it calls the corresponding page. i hope you understand what im talking about
-
up to my .as in code
I do
Love the title of this post...had to mention it.
-
Thanks for the feedback. I think I follow you with the goto stuff, but I am a little confused on the switch statement. Could you please expound on that. Thanks
-
Bearded (M|G)od
switch is just a shorter version of if..elseif statements. for example:
Code:
switch(_root.goTo){
case 'news':
_root.newsfloat.play();
break;
case 'page2':
_root.page2float.play();
break;
}
that is the same as doing:
Code:
if(_root.goTo == 'news'){
_root.newsfloat.play();
}else if (_root.goTo == 'page2'){
_root.page2float.play();
}
-
 Originally Posted by MyFriendIsATaco
switch is just a shorter version of if..elseif statements. for example:
Well, almost but there are some major difference. For instance:
1) switch() can only check equality. It can NOT check > or < .
2) You can check mulitple cases at a time by not including a break imediately after the case. eg.
code:
for (i:Number = 0; i<40; i++) {
j = Math.floor(i/4);
switch(j) {
case 1:
case 3:
case 5:
X += 50;
break;
default:
X += 10;
}
}
Or something like that.
P.S. You guys need to get a new code parser
-
I still can't get this to work so if here is my file that I am working on could somebody please look at it and help me with the code. Thanks for your patience with this newbie.
Here is the file floats
-
Bearded (M|G)od
yeah, i didnt really wan to get into depth with switch(), i just showed him enough for his situation, i like to let people learn something on their own.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|