For the life of me I can't find an internet source that explains why this doesn't work. I know it's a scope problem but I know no other way around it and there must be a way to do it, I'm thinking.
I have a class. Inside this class I create a movieclip which I have a class variable link to. The movieclip is created on _root. When I click on this movieclip, I want it to call a function inside the class. Here's what it looks like.
In the above sample, when I click on the movieclip, the "doSomething" function is not called, obviously because the movieclip is on root and has nothing to do with the class. Is there a way to do what I want to do?Code:class Whatever extends Movieclip { private var mc:MovieClip; public function Whatever() { this.mc = _root.createEmptyMovieClip("rootmc",_root.getNextHighestDepth()); [code for drawing a square] this.mc.onPress = this.doSomething(); } public function doSomething { [do something] }




Reply With Quote