In the first example, you did not import BitmapDataChannel, and it threw an error. Worked fine in a class once the BitmapDataChannel and Sprite import were added and the class extended the Sprite.
Good catch. I have updated the source files with runnable examples, so this will be fixed the next time we push live.
Senior Content and Community Manager
Adobe Systems Incorporated
Europe, Middle East and Africa