Current stage:
Class 1 - box on right:
package
{
import flash.display.*;
import flash.events.*;
public class box extends MovieClip
{
public function box()
{
}
public function moveBoxTo(boxX:int, boxY:int):void
{
this.x = boxX;
this.y = boxY;
}
}
}
Class 2 - box on left:
package
{
import flash.display.*;
import flash.events.*;
public class button extends MovieClip
{
private var buttonState:Boolean;
public function button()
{
buttonState = false;
this.addEventListener(MouseEvent.CLICK, clicked);
}
private function clicked(e:Event):void
{
if (buttonState === false)
{
//this.parent.boxMC.moveBoxTo(0,0);
buttonState = true;
}
else
{
//this.parent.boxMC.moveBoxTo(0,0);
buttonState = false;
}
}
}
}
Box on left is a button which when pressed moves button on right. Except it doesn’t as I can’t access a class method from within another.
Solution any one?