Hi, I have an interface design that involves a bunch of boxes bouncing around inside a containerMC. The boxes will slow down as the mouse pointer approaches to make clicking on individual boxes easy.
I’ve done 1 or 2 versions of this already and it’s just not happening for me, the boxes seem to get stuck together and I did it really stupidly by doing a new MovieClip for every single box so it was taking ages to publish.
I’m starting again, trying to do things a bit more dynamically…
So, just until I get it working again, I’ve got a new flash document that I drew a small box in, converted the box to a MC and then copy and pasted it until I had 3 boxes. I’ve given each copy a different instance name, “box1”, “box2” & “box3”.
There’s also a dynamic textbox (“boxNum”) inside this (one) MC that will contain a number from 1 to 3.
So anyway, I just want to have these boxes chasing the mouse before I move onto bouncing off each other and walls. What should I do about this mess?
//If statement to determine which numText each box contains
if (this == _level0.box1) {
this.boxNum.text = “1”;
} else if (this == _level0.box2) {
this.boxNum.text = “2”;
} else if (this == _level0.box3) {
this.boxNum.text = “3”;
}
//Set some variables
this.yspeed = 2;
this.targetx = _root._xmouse;
this.targety = _root._ymouse;
//Targets for box positions are the mouse cursor
onMouseMove = function () {
targetx = _root._xmouse;
targety = _root._ymouse;
};
//onEnterframe stuff that moves the boxes
onEnterFrame = function () {
this._x = (targetx-_x)/xspeed;
this._y = (targetx-_y)/yspeed;
};
Thanks heaps.
Pete