I have two pencils continuosly making stars and crosses when they are on a certain area. For doing that, I’m using attachMovie. Question is: how do I control the spacing between instances? Right now they overlap each other, and what I like is to be a space equal the size of the stars/shapes.
You can see a live example here: http://www.speedyshare.com/556221669.html
The source file: http://www.speedyshare.com/971633746.html
Frame 1
_root.pencil1.onMouseMove = function() {
if (_root.shape.hitTest(_root.pencil1._x,_root.pencil1._y, true)) {
_root.generateStar();
}
}
_root.pencil2.onMouseMove = function() {
if (_root.shape.hitTest(_root.pencil2._x,_root.pencil2._y, true)) {
_root.generateCross();
}
}
var Count = 0;
function generateStar() {
if (Count < 25000) {
Count++;
var currentStar = "star" + Count;
_root.attachMovie("star",currentStar, Count);
_root[currentStar]._x = _root.pencil1._x;
_root[currentStar]._y = _root.pencil1._y;
}
}
function generateCross() {
if (Count < 25000) {
Count++;
var currentCross = "cross" + Count;
_root.attachMovie("cross",currentCross, Count);
_root[currentCross]._x = _root.pencil2._x;
_root[currentCross]._y = _root.pencil2._y;
}
}
On MC pencil1 (similar for pencil2)
on (press) {
this.swapDepths(9999)
startDrag(this, true);
gotoAndPlay(2);
}
on (release) {
this.swapDepths(8888)
stopDrag();
gotoAndPlay(1);
if (_root.shape.hitTest(_root.pencil2._x,_root.pencil2._y, true)) {
_root.generateCross();
}
this._x = 100;
this._y = 200;
}
Thanks in advance for your help.