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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with punaises board ..

Status
Not open for further replies.

Roel018

Programmer
Jun 12, 2002
30
0
0
NL
Guys... (and girls) ..

I'm trying to add a punaise on a board each time I click on a ADD PUNAISE button.. I'm duplicating the movieclip of a punaise.. Seems quite simple. However.. it get's tricky when I try to detect the x- and y-cos of the different mc's.. For instance, when the user places a punaise on top of another punaise, I need to know the exact x- and y -cos of BOTH mc's to determine which on has to get on TOP in depth... Getting that info from the one I placed urlier is pretty hard... Here's the AC I have so far for the duplicated MC (the punaise)... :



ActionScript:

on(press){
this.startDrag();
this.gotoAndStop(2);
_global.current_active_punaise = this._name;
_global.last_active_punaise = this._name;
}

on(release){
this.stopDrag();
this.gotoAndPlay(3);
_global.current_active_punaise = "none";
last_placed = "punaise_mc"+start_mc_number;
//trace("x_coordinates of punaise ("+last_placed+"): " + this._x);

if(_global.start_mc_number > 0){
var c:Number = 0;
while (c++<_global.start_mc_number) {
qeued_punaise = "punaise_mc"+c;
with(qeued_punaise){
trace("x_coordinates of punaise ("+qeued_punaise+"): " + _x + " " + _y);
}

}
}
}


THIS IT MY OUTPUT:
Code:

1 punaise_mc1 x_coordinates of punaise (punaise_mc1): 174.4 90.2 2 punaise_mc2 x_coordinates of punaise (punaise_mc1): 354.4 -10.8 x_coordinates of punaise (punaise_mc2): 354.4 -10.8 3 punaise_mc3 x_coordinates of punaise (punaise_mc1): 358.4 101.2 x_coordinates of punaise (punaise_mc2): 358.4 101.2 x_coordinates of punaise (punaise_mc3): 358.4 101.2


THIS SHOULD BE my output:
Code:

1 punaise_mc1 x_coordinates of punaise (punaise_mc1): 174.4 90.2 2 punaise_mc2 x_coordinates of punaise (punaise_mc1): 174.4 90.2 x_coordinates of punaise (punaise_mc2): 354.4 -10.8 3 punaise_mc3 x_coordinates of punaise (punaise_mc1): 174.4 90.2 x_coordinates of punaise (punaise_mc2): 354.4 -10.8 x_coordinates of punaise (punaise_mc3): 295.2 101.2


Plz help I have been searching for a solution all day long !!!!

Thnx
 


For if the post above is too complicated, here it is in short:
==========================================

This is what I have:


on(press){
current_mc = current_mc + 1;
new_mc_name = "new_mc_nr_" + current_mc;
newDepth = _root.getNextHighestDepth();
_root.mc_original.duplicateMovieClip(new_mc_name, newDepth);
}

on(release){
trace(new_mc_name);
trace(new_mc_name._x);
}


Now, the PROBLEM is that trace(new_mc_name works great.. I get new_mc_nr_1, new_mc_nr_2, etc.. exactly as supposed to.. However, when I try to get the _x of these seperate MCs, i get an UNDEFINED return... I do this like this:

trace(new_mc_name._x) (with new_mc_name as the last created MC, so could be new_mc_nr_1, new_mc_nr_2, etc.... I need to get the _x of these MCs.. All I get is UNDEFINED.... :(

Plz help me !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top