Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coldfusion Code128 barcode problem 11 226
Serif Plus workable? 4 46
Web Expression 4 + PHP v5.5 2 55
span onclick not working if no string displayed 7 63
When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
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…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

895 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