A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Writing an intermediate SWITCH statement

  1. #1
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57

    Writing an intermediate SWITCH statement

    I am trying to create a slightly more complex switch statement; a statement where each case executes multiple actions. In the way I have it written below, the switch only executes the first line of each case. How can I make it so the statement executes more than one?

    Code:
    switch(panoID){
    		case 0:trace(panoID);
    			unloadMovie(_root.panoLoader.panosGoHere);
    			loadMovie("panos/main-entrance.swf", _root.panoLoader.panosGoHere);
    			panoLocation="main entrance";
    			map.hotSpotSelected._x=map.pano1._x;
    			map.hotSpotSelected._y=map.pano2._y;
    		break;
    		case 1:trace(panoID);
    		break;
    	}

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Humm not sure about this, but I execute mutliple lines of code with switches all the time try moving the first line down such as:

    switch(panoID){
    case 0:
    trace(panoID);
    unloadMovie(_root.panoLoader.panosGoHere);
    loadMovie("panos/main-entrance.swf", _root.panoLoader.panosGoHere);
    panoLocation="main entrance";
    map.hotSpotSelected._x=map.pano1._x;
    map.hotSpotSelected._y=map.pano2._y;
    break;
    case 1:
    trace(panoID);
    break;
    }
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57
    Guess that was all I needed to know. It turns out the switch was fine, it was the other code that was wrong.

    Thanks!

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