Freewind
Freewind

Reputation: 198248

How to understand "this" keyword in flex

It seems stackoverflow ignores this keyword when searching.

It seems the this keyword in flex is different from JavaScript's. I feel it similar with Java's, but not sure.

How to understand it?

Upvotes: 0

Views: 517

Answers (3)

TobiHeidi
TobiHeidi

Reputation: 1241

this can be a bit confusing for newcomers to MXML. In MXML this is the current "root tag" not the tag you are attaching an eventlistener to, or giving some databinding.

Even so it might be a bit confusing at first, if you think about it it makes perfect sense as an MXML file basically compiles down to a single .as3 class which this referes to.

Upvotes: 1

Dee
Dee

Reputation: 436

"this" works same as it works in Java or C#. If you are familiar with C#, this link might help c# is adding "this" optional within a class method

Upvotes: 0

AlBirdie
AlBirdie

Reputation: 2071

In AS3, this is the same as in Java, the reference to the current object.

Upvotes: 0

Related Questions