Follow | mouse
How to make a text mouse to follow? In fact, only a few sentences can be completed.
Add the following code to frame 1th:
Aiyi_text = "Flash bar WWW.FLASH8.CN";
Define the text variable, which is the word to follow the mouse
I_len = i_text.length;//Calculate the total length of text
n = 0;//The following as to do is: the I_text with the substr string intercept functions, respectively, into the new MC.
while (N<i_len) {
_root.createemptymovieclip ("It" +n, n);/New MC
t = I_TEXT.SUBSTR (n, 1),//I_text using SUBSTR string to intercept functions, into a single text.
With (_root["it" +n]) {
Createtextfield ("aiyi_t", 2, 0, 0, 30, 30);//Create a text in the current new MC.
I_t.text = t;//is assigned a value for this text, which is the T value above.
}
n++;
}
StartDrag (It0, true);/Drag the MC with the first word
_root.onload = function () {
When this MC is tuned in, the as only executes once
Speed = 3;
Set speed
};
_root.onenterframe = function () {
Every time a frame is played, it executes once inside the AS
i = 1;
Set the initial variable
while (i<=_root. I_len) {
_root["it" +i]._x + = (_root["It" + (i-1)]._x-_root["It" +i]._x)/speed;
_root["it" +i]._y + = (_root["It" + (i-1)]._y-_root["It" +aiyi]._y)/speed;
The two statements above are used to control the position of the X and Y axes of all box.
i++;
}
};
_root.mouse.hide ()//Hide Mouse