> My question is, do all these same rules apply, to ActionScript that is
contained within .MXML files?

Yes, it is exactly the same. All mxml files are actually quasi classes. The all get compiled into as3 classes.

So, if you had a button like

<mxApplication ...

   <mx:Button id="myButton" click="trace(this)" />

would trace your application.

Even if you have 3 VBox's listed inside themselves {this} will still point to the app.

myButton is just a property of the application. This goes the same for any component becasue an mxml component is just actually a as subclass behind the scenes.

MXML is just a markup of an as3 class. <mx:Component> has also the same scope going on. It will change the meaning of {this};

Read more in the manual about that tag, it just changes scope.

As far as using this, there are in my opinion only a few time you would actually write {this}. Other than that I use it for code hints then erase it. :)

Peace, Mike

On 8/10/06, Mike Anderson <[EMAIL PROTECTED]> wrote:

Hello All,

I am curious about the "this" keyword, as it relates to .MXML files.

As far as I know, you don't treat ActionScript any differently when it's
contained within .MXML files. But when it comes to using "this", I am a
little fuzzy - because I am seeing mixed examples of coding styles, and
all these examples are from well-known Flash/Flex Gurus...

When talking about an ActionScript Class - "this" is used of course,
when referring to Variables that were declared in the main constructor -
and helps keep those Variables separate from other Variables
(potentially with the same name) that are local to functions.

My question is, do all these same rules apply, to ActionScript that is
contained within .MXML files?

I know this may sound like a goofy topic, but I would love to have it
clarified - so I can continue to write quality code, that conforms to
the latest coding standards/techniques.

Thanks in advance,

Mike




--
What goes up, does come down. __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





YAHOO! GROUPS LINKS




__,_._,___

Reply via email to