A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to pass mouse events from top sprite to bottom sprite ?

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    8

    How to pass mouse events from top sprite to bottom sprite ?

    I am loading an external SWF onto my stage, using the 'Loader' class.
    I then put the 'Loader' class in a 'MovieClip' object, and add it to the stage.
    I now add another layer on top of that which is transparent, and has an 'x' button in the top right corner and a border around it.
    (client requirements dictate that these two layers are separate, meaning - I can't add the 'x' and border to the externally loaded SWF itself).

    Here is what both layers look like separatly:
    Layer 0 and Layer 1.png



    and here is what both layers look on top of each other:
    Layer 0+1 together.png


    What I need is this :
    I have an event catcher for the 'mouse roll-over' and 'mouse roll-out' and 'mouse click' of the top layer.
    When 'roll-over' happens - I change the width of the border.
    When the 'x' is clicked - I hide both layers.

    The problem is - the bottom layer of the externally loaded SWF is an interactive SWF with animation.
    I need to be able for the mouse to interact with the bottom layer, too.

    I tried dispatching the 'Mouse-Move' event to the 'MovieClip' that holds the SWF and tried dispatching it to the 'Loader' object inside of it,
    but it didn't work.

    (I should be able to see some animation changing when the mouse is over it).

    How can I achieve what I need ?

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    As far as I can understand your question, I don't think flash allows stacked objects to both interact with the mouse. You can place buttons or items that are smaller than the interaction and not deactivate the loaded swf.

    If you put an object on the top layer and add actionscript to listen for mouse activity, then by default it will block any mouse activity below it even if the alpha/opacity is set to 0%.

    If I had to solve this problem, I would remove the border, since the swf being loaded is interactive. I would just code the "x" to close the loaded interaction.

    Hope this helps.

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    8
    Quote Originally Posted by jkell View Post
    As far as I can understand your question, I don't think flash allows stacked objects to both interact with the mouse. You can place buttons or items that are smaller than the interaction and not deactivate the loaded swf.

    If you put an object on the top layer and add actionscript to listen for mouse activity, then by default it will block any mouse activity below it even if the alpha/opacity is set to 0%.

    If I had to solve this problem, I would remove the border, since the swf being loaded is interactive. I would just code the "x" to close the loaded interaction.

    Hope this helps.
    Thanks,
    I will post a new thread asking exactly this !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center