I've got this weird problem and i just cant figure it out. I'm using the localToGlobal to get the coordinates for my character and do a hittestpoint on a level clip. Everything works fine in flash player 10.1. r52
But then i open the exact same .swf on a other machine running flash player 10.0 r22, and the hittesting doesnt work. I tried everything, tracing the parents etc.
The setup:
Main Class, in Main Class i add a Game class(Sprite). In the Game Class i add a Level Class(Sprite) and a Character Class(Sprite)
the 'camera' follows the character, and the Game class is moved arround.
So
Main (static x & y)> Game (dynamic x & y)> Level(static x & y) & Character (dynamic x & y) this is my code:
private function checkLanded():Boolean
{//this code runs on the character class, so 'this' = character
var localPoint:Point = new Point(this.x, this.y + this.myHeight / 2 + 1);
var globalPoint:Point = parent.localToGlobal(localPoint)
if (Settings.levelGround.hitTestPoint(globalPoint.x,globalPoint.y,true) || Settings.levelPlatforms.hitTestPoint(globalPoint.x,globalPoint.y,true))
{
return true;
}
return false;
}
So this code runs perfectly in flash player 10.1 but not in 10.0 Now for 10.0, instead of using parent.globalToLocal, i tried parent.parent.globalToLocal which does work in 10.0 and not in 10.1.
How can i make sure that this code will run in all flash players.
**edit- I fixed it, i moved the main class arround which somehow disturbed the flash coordinate system. I then tryed moving the game class arround and that seem to work. Still wondering why moving the main class arround doesnt work..
Please help me,
Thanks in advance,
Erik Sombroek