A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: hitTest method 2 and dynamic mc's...

  1. #1
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506

    hitTest method 2 and dynamic mc's...

    Hey..

    Has anybody successfully used hitTest method 2 with a dynamically created mc?

    syntax:

    dynamicMovieClip.hitTest(x,y,true)

    Or has anybody had problems trying it in the past?

    Just wondering...

  2. #2
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    the x, y values used with hittest MUST be global ie relative to _root. if your mc (who's position your testing) is within another mc then you need to make the co-ordinates global. you can do this by using localToGlobal();
    code:

    var p = { x:0, y: 0 };
    localToGlobal(p);


    make sure this code is executed WITHIN the mc you want to get the co-ordinates of.
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  3. #3
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    Oooh that could be it.

    I'll check it out.

  4. #4
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    Yeah cheers. It was a scope problem.
    It's happened a couple of times before but always with dynamic mc's. Not sure why it happened before, but this time it was just mouse coordinates not globalised.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center