Mouse_Down on multiply objects.. kinda
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Mouse_Down on multiply objects.. kinda

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

    Mouse_Down on multiply objects.. kinda

    Not quite sure how to title this but i'll explain..

    I'm doing some code which includes a jigsaw.. now, the jigsaw image is a PNG which has transparent sections. Instead of just leaving it so the hitbox area is the whole movieclip, i have a tiny bit of code which checks if the PNG pixel at that point is transparent or not. If it isn't, then it's part of the piece so the draging of it starts. This is controlled via a Mouse_Down event on the jig itself (to start draging) and a Mouse_Up to stop. When you click and it sees the bit is transparent, it doesn't allow the dragging to start. Simple, works fine.

    but....

    What if there is another jig under the one you clicked on? the Mouse_Down event won't fire again until you release the mouse and then click again. I've put in a depth change so the new piece is on top, but you need that second click to start the dragging..

    I would like it to kinda say 'Oh, can't click on this one? well, lets check and start it on the next one'.. the only way i can think to do this is with a loop which then checks every single jig to see which one you have clicked on and then if it's a valid area to click on. ideally, i would perfer to do it without this waste of processor power but i'm not sure if there is a way..

    Any ideas? a Dispatch event call for the Mouse_Down would be pointless cause it needs to know the target, so i'm back to the loop.. changing the mouse down to be the stage and then check which piece is being click on (and then check the depth) is also pointless..

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    883
    do vector mask and mouse events will fall through
    who is this? a word of friendly advice: FFS stop using AS2

  3. #3
    Member Manic_Man's Avatar
    Join Date
    Dec 2007
    Location
    Hastings, England
    Posts
    91
    yeah.. that would do the job but it's a transparent png like I said. to convert a transparent png to a vector to make the mask would be a bit tricky. I don't know how to use bitmap data to construct a vector mask.

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

Poll by Flashkit.com