A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: scripting cramp!

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    18

    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

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    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

  3. #3

  4. #4
    Junior Member
    Join Date
    May 2006
    Posts
    18
    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

  5. #5
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    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();
    }

  6. #6
    Member
    Join Date
    Apr 2005
    Posts
    65
    Quote 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

  7. #7
    Junior Member
    Join Date
    May 2006
    Posts
    18
    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

  8. #8
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center