When making an swc componenet, do you NEED to make a new .as class?

I’ve just been doing some reading trying to figure out how to make precompiled swc components in cs4. All the examples I’ve seen involve creating an external as3 class, linking it to a symbol, and then compiling the symbol to an .swc
Does it always have to be done this way, using an externally written .as file? Can I have all the code within the timeline of my symbol in cs4?
For example, lets say I just wanted a component that is a rabit running back and forth, and just want a parameter in the component inspector that changes the speed of that rabit. Can I make a symbol with my running rabit, whose speed is controled by a variable, compile the symbol to an swc, and then have that speed variable as a parameter in the component inspector?

(This is not what I am actually doing by the way…the rabit is just a stupid example to simplify the idea of what I want to do…)

Thanks!