Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to click through a sprite to one below it...

Posted on 2003-10-21
5
Medium Priority
?
191 Views
Last Modified: 2013-12-24
How can I set it up so that a sprite which is a layer in front of all other ones does not impede the ability to click on pre established buttons?
0
Comment
Question by:bbonnefil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 20

Expert Comment

by:MediaMacros
ID: 9593495
If you do not put any behaviors on it it will typically let events pass through.  You can also use the pass command...

on mouseUp me
  pass
end
0
 
LVL 1

Accepted Solution

by:
peter-h earned 252 total points
ID: 9612913
Yes, not putting a handler for the event you want to pass in any behaviours on the top-most sprite will not trap that event. It will therefore pass it through to sprites underneath. However, once an event is trapped and being processed by your handler, the PASS command passes it on, NOT to other sprites on the stage, but to other behaviours attached to the same sprite, then onto any frame handler, then on to any global handler. This is often a source of confusion. Think of PASS as passing "along" and not passing "through".
To get around this, you can use the rollOver(whichSprite) function in your "top-most" handler to check to see if the mouse is over an "underneath" sprite, and manually invoke the handler in it.

e.g.
on mouseup
  if rollerover(underneathSpriteNumber) then sprite(underneathSpriteNumber).mouseup()
end
0
 
LVL 20

Assisted Solution

by:MediaMacros
MediaMacros earned 248 total points
ID: 9614067
Sorry, read that a bit fast.  

Here is a handler to pass the message down to the next sprite with a mouseUp handler...

property spriteNum

on mouseUp me
  repeat with x = (spriteNum - 1) down to 1
    --check the sprite
    if (the mouseLoc).inside(sprite(x).rect) then
      sList = sprite(x).scriptInstanceList
      if sList.count = 0 then nextRepeat
      --check the scripts
      repeat with s in sList
        h = s.handlers()
        if h.getOne(#mouseUp) > 0 then
          sendSprite(x, #mouseUp)
          exit
        end if
      end repeat
    end if
  end repeat
end
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question