A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Hit test and Vector Shapes

  1. #1
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91

    Hit test and Vector Shapes

    Okay, Now.. I've got a Movie clip container called 'MiniMap' Inside that, there are 2 move clips.. One is called 'Track' and the other is 'head1'. Now.. Track contains an image drawn via the Lineto/fill/etc Head is a movieclip that holds a bitmap image (well.. its a png right now. it'll probably be vector from design time in the end). That's all well and fine.. Now comes the tricky part.. hitTest!

    I want to find out when Head1's centre point is On the image (track) and when it's not. a simple hitTest(Head1._x,Head1._y,true) should work BUT it doesn't..

    I have a few ideas why it might not be working but nothing really that sound and i think giving my feeble ideas would just bias anyone..

    I did think that maybe flash can't detect images drawn as vectors like that, but i don't think that's the case.. any thoughts?

  2. #2
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91
    Just to help out others I have found the problem..

    I can't detect it all BUT because i had both movie clips inside another, it created a problem with hitTest which may be known to others (and might be the reason i didn't find anything on the problem in relation to vector runtime graphics). hitTest using Scene based X and Y pos values. Because 'head1' was inside a movie clip, it only had it's local x & y values. this created the problem and is fixed by adding the X and Y values of the container clip to there values when doing the hit Test.

    I hope this helps people in the future that have these problems

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