In AS3 switch construction uses break - otherwise it'll fall through (all
cases will be executed after the first case that matches the condition).
Besides, you can leave the condition blank and put any statement in the case
block, however, you have to be careful that the cases are unique. Example:

switch ( true )
    {
       case (orgStructureADG.selectedItem is VendorCompcodeData):
       {
         trace( "VendorCompcodeData" );
       }
       break;
       case (orgStructureADG.selectedItem is VendorPurchorgData):
       {
         trace( "VendorPurchorgData" );
       }
       break;
       default:
       {
         trace( "default" )
       }
    }

However, I would do it like this:

switch ((orgStructureADG.selectedItem as Object).prototype)
    {
       case VendorCompcodeData:
       {
         trace( "VendorCompcodeData" );
       }
       break;
       case VendorPurchorgData:
       {
         trace( "VendorPurchorgData" );
       }
       break;
       default:
       {
         trace( "default" )
       }
    }

Best.

Oleg

Reply via email to