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!

problem with _x _y in function

Status
Not open for further replies.

mike722

MIS
Sep 8, 2001
65
BR
Hello, I am attaching a movie and assigning the _x and _y position of that move. The following code works without any problems:


this.attachMovie("apple","apple1",1);
apple1._x = 350;
apple1._y = 350;

--------------------------------------------------------

I am trying to create a function to run the above code using variables. The following function that I have written attaches the movie, but ignores the _x and _y positions that I state when running the function (just places them at 0,0). Can anyone see the problem?
I have traced the relevent variables and they return the correct values.

//this is the function

function CallAlpaMov (clip,Intname,depth,x,y){

this.attachMovie(clip,Intname,1);
Intname._x = x;
Intname._y = y;
trace (x);
trace (y);
trace (Intname);
}

//Calling the function here
CallAlpaMov ("apple","apple1",1,350,350);
 
Try this, setting the x & y coordinates as part of an initialisation object in the attachMovie line:

Code:
function CallAlpaMov(clip, Intname, depth, x, y) {
	this.attachMovie(clip, Intname, depth, {_x:x, _y:y});
}
//Calling the function here
CallAlpaMov("apple", "apple1", 1, 350, 350);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top