David, I just re-read your original post, and I'm wondering what you mean by the following:
"when I try to create a class in the inline code of an mxml page " The first time I read this, I assumed that you meant that you were instantiating a class in an MXML file. Is that what you meant? Or are you actually trying to write a class within the <mx:Script> block of an MXML file? If it's the latter, then that's your problem. You should create the AS class in its own separate file. -Jim --- In [email protected], David Steele <[EMAIL PROTECTED]> wrote: > > I now have the following, but I get the same error: > > import flash.display.Sprite; > import flash.events.*; > import flash.net.XMLSocket; > public class socket extends UIComponent > { > ... > > ----- Original Message ---- > From: Jim Robson <[EMAIL PROTECTED]> > To: [email protected] > Sent: Tuesday, January 9, 2007 10:58:54 AM > Subject: [flexcoders] Re: Referring to created AS class from within MXML > > 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 [EMAIL PROTECTED] ups.com, David Steele <stldvd@> 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 > > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com >

