The use of "this" in AS class:
class A {
private var someVar;
...
this["someVar"]
// this will work....
function someFunc() {
this["someVar"]
// this will work, too.} }
however if there's a movieclip in _root, and we want to use it in class A:
class A {
this["movieClip"]
// will not work....
function someFunc() {
this["movieClip"]
// will not work, neither.} }
You can use _root to target that MC anyway, however that's not a suggested idea.
I'm still looking for some way to overcome "this".(-"-;A
2006-8-2
Did some search and found:
gSkinnerSeems like not to use _root is the trend, they even deleted _root in AS3.
However if you're not on a big project, and sure you won't have to put your project's swf into some other project, then _root will still be a convenient way - there are not efficient way to replace _root YET.
2006-9-6
There is one way to use this in a class: in root you create a class like:
var someclass:someClass=new someClass(this);then you can create a movieclip variable to store _root in your class:
private var stage:MovieClip;so later you will assign _root to variable like:
function someClass(target:MovieClip) {
stage=target; }now you can use stage[] to access _root :-)