Solved

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

Posted on 2003-10-21
5
180 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
  • 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 63 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 62 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now