Hi everyone,
I just started learning AS3, and I’m having a good time with it so far, but I stumbled upon something I have no idea how to fix. If I were more experienced, I probably could find a solution easily, but alas, I barely know any AS3. I can’t go on learning without figuring out exactly what’s wrong with this, since it’s going to bug me in the back of my mind until I do. That’s the way I work.
Here is the code:
package{
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class sandBox extends MovieClip{
public function sandBox(){
var myText:TextField = new TextField();
myText.text = "SUP."
addChild(myText);
for(var i:int=0;i<10;i++){
var Circle:Sphere = new Sphere();
Circle.x = 40*i+50;
Circle.y = 200;
Circle.scaleX = i*.4;
Circle.scaleY = i*.4;
Circle.buttonMode = true;
Circle.addEventListener(MouseEvent.CLICK,clickCircle);
function clickCircle(event:MouseEvent){
this.y += 10;
}
addChild(Circle);
}
}
}
}
Specifically, my problem regards this:
function clickCircle(event:MouseEvent){
this.y += 10;
}
When I click any of the Circles, nothing happens. My intention is to make clicking a Circle move it down.
Thank you for your time.