🤯 50% Off! 700+ courses, assessments, and books

Flash Script – Cursor-Responsive Text

Georgina Laidlaw
Share

1. Create a text field, name it "txt", and then convert it to a movieclip.

2. Give the movie clip an instance name of "a1".

1065_tool1

3. Create a new movieclip and give it an instance name of "a0".

4. Create layers as shown below.

1082_tool2

5. In the actions layer in the first key frame, insert the following action:

x = new Array();  
y = new Array();  
text = "Flashcircle.com";  

// mx x value of movieclip  
mx = getProperty("/a1", _x);  
txtlength = length(text);  
/a1:txt = "F";  

//loop through to create duplicate movieclip  
for (i=2; i<=txtlength; i++)  
{  
duplicateMovieClip ("/a1", "a" add i, i);  
setProperty ("/a" add Number(i), _x, mx);  

// substring to put individual letter into movieclip  
set ("/a" add Number(i) add ":txt", substring(text, i, 1));  
}

6. In the actions layer in the third key frame, insert these actions:

//code to make the text follow  
for(i=1; i<=txtlength; i++)  
{  
x[i] = getProperty("/a" add Number(i-1),_x);  
y[i] = getProperty("/a" add Number(i-1),_y);  
x[i] = x[i]+10;  
}

7. In the actions layer in the fourth key frame, insert the following:

//code to make the text follow  
for (i=1; i<=txtlength; i++)  
{  
setProperty ("/a" add i, _x, x[i]);  
setProperty ("/a" add i, _y, y[i]);  
}  
gotoAndPlay (2);

8. Right click the "a0" instance movie clip, and insert these actions:

onClipEvent (load)  
{  
startDrag ("", true);  
}

9. Easy, wasn’t it? Press ctrl+enter to test you movie.