Giles, I really try not to be pest, but I'm afraid I am. I apologize ahead of time, but thanks to you I feel close to solving this so I can't stop myself from asking....

You are absolutely right about the centerPoint. duh, I wasn't giving a reference point.

but the one thing still confuses me is why what should be a constant value (point.x, point.y) changes each time the function is called using the same arguments.

it of course has something to do with localToGlobal and the object "point". I think I'm missing a fundamental characteristic of objects or the nature of localToGlobal.

somehow localToGlobal should only be called once? the object point doesn't go away each time the function is called even though it is preceded by var?

the function again...

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); }

I need to establish the localToGlobal values outside of the function or can I destroy the function after each use?

sorry for being a pest!!!

thank you again!!
Kurt



At 09:52 AM 10/7/2005, you wrote:
Hi Kurt,
What you are doing, I think, is putting the x&y of map to where
springfield is. If you want to center springfield on the stage then I
think you need to:

var centerPointX = Stage.width/2;
var centerPointY = Stage.height/2;

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



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kurt
Dommermuth
Sent: 07 October 2005 14:33
To: flashcoders@chattyfig.figleaf.com
Subject: Re: Fwd: RE: [Flashcoders] localToGlobal ?

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.


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

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

Reply via email to