Hi Giles,

thank you for responding. this is exactly what i'm doing but my "MAP" just shoots right off the stage.

selectCommunity = function(communityName)
{
        var point:Object = {x:map[communityName]._x, y:map[communityName]._y};
        map[communityName].localToGlobal(point);

        map.tween("_y",point.y,.6,'easeOutSine');
        map.tween("_x",point.x,.6,'easeOutSine');

        trace("point.y = " + point.y + " point.x = " + point.x);
}

trace reveals point.y = 255.9 point.x = 768.9
then next time the function is called: point.y = 779.7 point.x = 1436.8

so ive got two issues. the map doesn't center on "springfield" and the x and y value increase with every call. I though var made it private. this is not the case with objects? totally missing the boat.

nwebb, thank you for the link.  I haven't tried the function there, but I will.




At 08:46 AM 10/7/2005, you wrote:

Say you have a movieClip called "A_mc" on the stage that you move to
x:20 y:20, then you have a movieClip in "A_mc" called "B_mc" that you
place at x:20 y:20.

When looking at the stage "A_mc" will be at x:20 y:20, but "B_mc" will
be at x:40 y:40.

However, if you ask what B_mc._x is then it will say 20 because it
relates it to it's parent movieClips registration point(x:0 y:0).

So to find out when "B_mc" actually is on the stage you use:
var myPoint:Object = {x:B_mc._x, y:B_mc._y}
B_mc.localToGlobal(myPoint);
Trace("myPoint is now relative to the Stage: (" + myPoint.x + ":" +
myPoint.y + ")");

So, in your case you would say:
var myPoint:Object = {x:MAP.springfield._x, y:MAP.springfield._y}
MAP.springfield.localToGlobal(myPoint);
Trace("myPoint is now relative to the Stage: (" + myPoint.x + ":" +
myPoint.y + ")");

Hope that help you "get" it.
Giles

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to