Solved

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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.
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 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…
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…

816 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

10 Experts available now in Live!

Get 1:1 Help Now