Flash make text mouse follow

Source: Internet
Author: User
Tags functions
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.