I’m having problems getting a simple switch statement working. I’m doing this in Flex 2.0, so that might be the problem, but here is the code

PHP Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        <![CDATA[
    public var dayNum:Number = 1
    switch(dayNum) {
        case 0:
          trace("Sunday");
          break;
        case 1:
          trace("Monday");
          break;
        case 2:
          trace("Tuesday");
          break;
        default:
          trace("Out of range");
    }
 
    ]]>
    </mx:Script>
</mx:Application>


Flex is giving this error:

1120: Access of undefined property dayNum.


Any ideas?