Your code is the colorful stuff, not the grey stuff. The lower the colorful stuff is under the bar, the better your code is running. Your code looks good here.
You are running at 31% of your budget 25ms per frame (it says so in the Summary panel). 25 ms is 1000ms/40fps.
The red line represents the desired SWF frame rate. This is usually set when you create the SWF file in FlashPro, FlashBuilder, or other tools. It can also be set in directly in ActionScript code. Since yours is at 40, you must have already set it somewhere.
You need to look at the grey bars. Grey represents time waiting for the next frame, not the time spent running your frame. Grey is good. If you don't see any grey below the red line, your code is taking too long to run in that frame. The grey bars are showing you the actual intervals between each frame. In your case these are alternating above and below the line. If you select a range of frames, you will find that the average is right at 40, but each individual frame time will be more or less. The flash player has an internal algorithm to average these intervals to make your desired rate. The player prefers rates that are divide evenly into 60, like 60, 30 or 15. If you choose other rates, it will adjust the frames so that they fit into this pattern. So you are seeing alterating frames which average nicely to 40fps. This is normal player behavior. it does this so that multiple flash sessions don't put too much demand on the CPU by only waking up in reliable intervals.
Thanks Gavin! This makes total sense. I think I get it now. I got confused and thought that the big number under Framerate in the Summary panel was related to just the active time in the frame. So any time it was below the target framerate, I got concerned. I now see it's the total frame time - active time plus inactive time. And that's it's natural and totally fine for it to fluctuate a little. This helps a lot. Grey is good! Thanks again.