David, DisplayObjects (Sprite, Shape, Bitmap) can't generally be used directly in MXML. To be able to add a child using an MXML tag, you need to extend UIComponent.
-Jim --- In flexcoders@yahoogroups.com, David Steele <[EMAIL PROTECTED]> wrote: > > I apologize for what must be an obvious question, but why when I try to create a class in the inline code of an mxml page do I get the 'Classes must not be nested' error? > > I'm trying to test a socket connection. I've got the socket code (which is a class); I know how to create mxml buttons etc. What I don't know is how to put the two together. I've created a new actionscript class file: > package { > import flash.display.*; > import flash.events.*; > import flash.net.XMLSocket; > > public class socket extends Sprite > { > ... > > I've also got a document called socketTest.mxml. How do I refer to to my AS class from within socketTest.mxml? Do I need to explicitly place the two files somewhere? > > Thanks. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com >