actionscript 3 - Flash Programming Local To Global problem -


i've got weird problem , cant figure out. i'm using localtoglobal coordinates character , hittestpoint on level clip. works fine in flash player 10.1. r52

but open exact same .swf on other machine running flash player 10.0 r22, , hittesting doesnt work. tried everything, tracing parents etc.

the setup:

main class, in main class add game class(sprite). in game class add level class(sprite) , character class(sprite)

the 'camera' follows character, , game class moved arround.

so

main (static x & y)> game (dynamic x & y)> level(static x & y) & character (dynamic x & y) code:

    private function checklanded():boolean     {//this code runs on character class, '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 code runs in flash player 10.1 not in 10.0 10.0, instead of using parent.globaltolocal, tried parent.parent.globaltolocal work in 10.0 , not in 10.1.

how can make sure code run in flash players.

**edit- fixed it, moved main class arround somehow disturbed flash coordinate system. tryed moving game class arround , seem work. still wondering why moving main class arround doesnt work..


please me,

thanks in advance,

erik sombroek

this way know coordinates of display object in reference stage

public function getdisplayobjectsrootcoord(target:displayobject):point{     var coords:point = target.localtoglobal(new point());     return coords; } 

or see if mouse on item...

var target:movieclip; var stage:stage;// make sure have reference var mouseoverpanel:boolean = target.hittestpoint(stage.mousex,stage.mousey,true); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -