Hi
I have a small problem with usage localToGlobal and than back to local. I can get global coordinate of my nested mc in question alright. Than i check if this coordinate + value of my mc.width is more than my stage width. I get to this part with no problem. Than if value is bigger (so mc is not on the stage i mean if part is off the stage i change value so it is stage width - mc.width). So i get value in global coordinates that i need.
**But how do i apply this to my nested clip is my question? **
For reference here is my code:
var localPointX = comet.comet_mc.cometText_mc.x;
var localPointY = comet.comet_mc.cometText_mc.y;
var localPoint:Point = new Point(localPointX, localPointY);
var globalPoint:Point = comet.comet_mc.cometText_mc.localToGlobal(localPoint);
var globalPointX = globalPoint.x;
var globalPointY = globalPoint.y;
if(globalPointX + comet.comet_mc.cometText_mc.width > stage.stageWidth)
{
var newCoordinate = stage.stageWidth - comet.comet_mc.cometText_mc.width - 20;
trace(newCoordinate);
}
I just need i litle push in right direction, how to apply this new global x that i get locally to my clip.
tnx
Luka