A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: [4.9.7.6] Greedy mouse listening objects

  1. #1

    [4.9.7.6] Greedy mouse listening objects

    I have a layer with the big3 mouse events (down, move, up). This part works alright, but all my check boxes have stalled (they do not display the 'click here' finger, they don't respond to clicks, and when I double click, they turn gray and freeze all mouse functioning within the movie. Not sure if this is because of the mouse events or not.)

    Clicking on this first layer creates a second layer that also has mouse events. Once this second layer is loaded, all mouse functioning is diverted to the layer (which is quite small) to the point that buttons don't even respond. I added mouse events to this layer because the first layer wouldn't respond to MouseUp if the mouse landed on one of the smaller layers.

    I don't know much about how Flash works with mice. What I want is a movie with checkboxes and buttons and a part of the screen that will respond to mouse events. Should I add a single mouse element to the root?

  2. #2
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    movie sample could help I tested one layer (with mouse click&release and drag and drop) and checkbox in main movie worked just fine..

  3. #3
    I tried to make a sample movie for the check boxes, but I have to deconstruct my program bit by bit, which creates all kinds of errors.

    As for the mouse getting blocked, that still happens. I moved the mouse listener to the root, and it is the only mouse element. When I click on a button, the mouse listener does not react, which is good. But when I click on a layer that has a smalltext on it, it also does not react, which is bad. How can I make a layer with paint and smalltext elements transparent to the mouse?

  4. #4
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    Hmm.. I'm not sure what was problem (your 1.st question..) but if you assign mouse action as an element for layer it catches events in whole movie... then if you add mouse onPress/onRelease as a feature events occur in that layer only (no outside press/release is catched).

    As for 2.nd post.. I think all events are catched by your mouse listener.. so small text newer gets its own mouseclicks ???

    I think you must desingn whole mouse event system with care, so events can be catched by right handlers!?

    But if you manage to get sample done, I'll give it more detailed peek

  5. #5
    I'll try to re-create the checkbox problem- it is clearly because of the mouse element because if I delete it, then the boxes work just fine.

    I attached two movies here-

    MouseTest1 shows a layer with a smalltext that is blocking the mousedown event to the root. Click around the movie on and off the box and you'll see what I mean.

    MouseTest2 is the same thing with a second mouse listener on the layer. Now, every click gets send to this layer, whether it is on or off the layer.

    Here's what I want to happen-

    I have several buttons and checkboxes. One part of the screen responds to mouseOn,Move,and Down. If you click on this part of the screen (I'll call it the Screen), the movie will create a small graphic (which I'm using a layer for now) that has a smalltext on it. I need to be able to drag from this graphic/layer to the Screen. I also need to be able to drag from the Screen to the graphic/layer, and between graphics.
    While dragging, the movie will draw a line between the start of the drag and the current mouse location, so I will need a MouseMove listener for each of these. How can I do this?

    -This would be easy if I could make graphics/layers that are transparent to the mouse, so all mouse events are handled by the Screen.
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    Quote Originally Posted by Sparky23

    MouseTest1 shows a layer with a smalltext that is blocking the mousedown event to the root. Click around the movie on and off the box and you'll see what I mean.
    If you move mouse element down it catches layer clicks too..


    Quote Originally Posted by Sparky23
    MouseTest2 is the same thing with a second mouse listener on the layer. Now, every click gets send to this layer, whether it is on or off the layer.
    Same here, if you move mouse element down then root gets all clicks...


    Quote Originally Posted by Sparky23
    Here's what I want to happen-

    I have several buttons and checkboxes. One part of the screen responds to mouseOn,Move,and Down. If you click on this part of the screen (I'll call it the Screen), the movie will create a small graphic (which I'm using a layer for now) that has a smalltext on it. I need to be able to drag from this graphic/layer to the Screen. I also need to be able to drag from the Screen to the graphic/layer, and between graphics.
    While dragging, the movie will draw a line between the start of the drag and the current mouse location, so I will need a MouseMove listener for each of these. How can I do this?

    -This would be easy if I could make graphics/layers that are transparent to the mouse, so all mouse events are handled by the Screen.
    Thats beyond my mouse experience... I'm not sure how to get get stuff from layer to another layer or "Screen",.. sure it is possible to drag whole layer or other element but how to draw line while doing that... I have to study the subject little more

  7. #7
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    See attached movie, is it even close what you are trying to do?? (no line drawing...)
    Attached Files Attached Files

  8. #8
    Getting there.
    The cloned layers won't be draggable themselves, rather, you can drag from a cloned layer, with a line drawn outward, and drop (mouseup) on either a second cloned layer or on the 'screen'

  9. #9
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    Actionscripting might be only real solution I think,.. or how you are dragging elements now??
    I found one tutorial about dragging and dropping with AS3 and I extended it a bit to add somekind of line.
    Basic idea is to call elements startDrag() when mouse is pressed and create onMove handler at same time. OnMove handler then draws the line in separate layer (clear, then draw..)
    Then when mouse button is released on move handler is removed, elements onDrop is called and line layer is cleared.
    I have no idea how you scripting skills are so I dunno if this is any help..
    Anyway, modified tutorial code I found is attached to this post. (works only in flash9)
    It might be possible to adopt this code to more 3dfa style but it takes some amount of thinking..
    Attached Files Attached Files

  10. #10
    I couldn't get that movie to do anything, even in flash9.

    I won't be dragging and dropping objects. I just need to keep track of the mouse position as it moves, clicks, and releases. The problem is, if the mouse handler is on the background, it doesn't register MouseUp over SmallText elements. If I put a second mouse handler on the SmallText, the background mouse handler gets ignored.

  11. #11
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    Thats weird.. I have tested it in 2 different computers and it works ok.. (3dfa 4.9.7.6..)

  12. #12
    Hmmm... well I'm pretty much stuck until I can get the mouse to work.

  13. #13
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    There were some issues with the Mouse element in 7.6 that needed to be looked at.

    There were differences between how 3DFA, Flash 8, and Flash 9 handled Mouse elements on different layers.

    7.7 is due for release tonite. The Layer Mouse element and the root Mouse element now both always receive the mouse event.

    You might consider sending a little movie to the 3DFA contact address for testing before the release.
    Last edited by kusco; 12-20-2007 at 03:53 AM.
    Cheers,
    kusco
    (3DFA Support Team)

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