A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: scripting cramp!

Hybrid View

  1. #1
    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();
    }

  2. #2
    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

  3. #3
    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

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