Hi
I am a new born to Flash and I am really wishing somone would help me make my insatallation a reality.
In short I want to adapt a script which generates random motion of two linked objects so that instead of the motion being RANDOM, I can feed an array of x an y cordinates of points to generate the movement.
The script is like this (courtesy of: Joshua Davies)
[COLOR=Blue]// init random jumping
randomMove = 50;[/COLOR]
// start a variable to count our duplicated movie clips
lineNum = 1;
this.onEnterFrame = function() {
[COLOR=Blue] // init Xpos movements
newXpos = this._x+(random(randomMove)-(randomMove/2));
curXpos = this._x;
if (curXpos<=_root.boundLeft) {
newXpos += random(randomMove);
} else {
if (curXpos>=_root.boundRight) {
newXpos += -(random(randomMove));
}
}[/COLOR]
// init Ypos movements
newYpos = this._y+(random(randomMove)-(randomMove/2));
curYpos = this._y;
if (curYpos<=_root.boundTop) {
newYpos += random(randomMove);
} else {
if (curYpos>=_root.boundBottom) {
newYpos += -(random(randomMove));
}
}
// execute movement
this._x = newXpos;
this._y = newYpos;
// scale line between redDot and greenDot
_parent.line_mc.duplicateMovieClip ("newLine_mc" + lineNum, lineNum);
_parent["newLine_mc" + lineNum]._x = this._x;
_parent["newLine_mc" + lineNum]._y = this._y;
_parent["newLine_mc" + lineNum]._xscale = _parent.greenDot_mc._x-this._x;
_parent["newLine_mc" + lineNum]._yscale = _parent.greenDot_mc._y-this._y;
lineNum++;
};
A full animation is here:(chapter 20d)
http://www.flashtothecore.praystation.com/ (chapter 20d)
Now Instead of a random movement, I would like to feed in an array that would make the movement. I guess I am supposed to be changing the blue highlighted parts of the script…? I would be really happy for some help.
Thanks
K.