1. <?xml version="1.0" encoding="utf-8"?> 
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" 
  3.                 creationComplete="switchCase1('cyrq'),switchCase2('cyrq')"> 
  4.     <mx:Script> 
  5.         <![CDATA[ 
  6.              
  7.             //正确的用法  
  8.             private function switchCase1(string:String):void 
  9.             { 
  10.                 switch (string) 
  11.                 { 
  12.                     case "cyrq": 
  13.                     case "ryrq": 
  14.                         trace("switchCase1=="+string); //正常打印 
  15.                         break; 
  16.                     default: 
  17.                         break; 
  18.                 } 
  19.             } 
  20.             //错误的用法(可恶的是,用或者符号|| 页面中也没有语法错误提示 ) 
  21.             private function switchCase2(string:String):void 
  22.             { 
  23.                 switch (string) 
  24.                 { 
  25.                     case "ryrq" || "cyrq": 
  26.                         trace("switchCase2=="+string); //不能打印 
  27.                         break; 
  28.                     default: 
  29.                         break; 
  30.                 } 
  31.             } 
  32.         ]]> 
  33.     </mx:Script> 
  34. </mx:Application>