Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS Animation ??

Status
Not open for further replies.

wikfx

IS-IT--Management
Dec 16, 2001
196
MT
Hi I am working on a little MC I want to know if its possible for me to do the following:
I have a line 5 pixels long, now using actionscrips I would like to move this line around on the screen, for exaple it starts at co-ordinates 0,0 than I would like it to move to specific co-ordiantes in this order:
200,0
200,100
250,100
250,0
-250,0
and whatever I think you get my point, anyway is there a way I can do this in actionscript so that I can avoid, doing it with keyframes coz I would like to make many different instances and path combonations. please let me know :)

Thanks
Brian
 
convert you line into a movie clip. name it line_mc. then use this code.
Code:
function moveLine() {
	line_mc._x = x_array[i];
	line_mc._y = y_array[i];
	i++;
	if (i == x_array.length) {
		clearInterval(interval);
	}
}
var i = 0;
var x_array = new Array(200, 200, 250, 250);
var y_array = new Array(0, 100, 100, 0);
var interval = setInterval(moveLine, 500);

Philip Keiter
Senior Flash Software Developer
Sphyrras
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top