Solved

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

Posted on 2003-10-21
5
187 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

749 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