A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: DETECTING MOUSE PRESS WITHOUT USING BUTTONS

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    3
    I am having a problem with a touchscreen presentation created in flash 4.
    the touchscreens are being used in the reception area of some high_class clinic,
    the client wants them to reset to an intro screen if no one uses them for a period of 5 mins
    i have managed to find an actionscript time delay but need to find a way of detecting a MOUSE PRESS / RELEASE, without putting a huge blank button over the whole screen (therefore rendering all the buttons beneath , completely useless) or having to add tell target actions into EVERY button in the WHOLE presentation.

    if anyone out there can help it would be much appreciated

  2. #2
    Registered User Bzdero's Avatar
    Join Date
    Feb 2001
    Location
    Split, Croatia
    Posts
    488
    My suggestion would be to export your file into flash 5 format (for it can be done in version 5 by movie clip event) and continue your work there. No, it can't be done in flash 4.

  3. #3
    You could also use a blank button (ie. button with a shape only in the "Hit" frame), place it in a MC and use the Drag Movie command. If you have the MC center on the mouse then it will follow the mouse around. This would solve both your need to detect a mouse click and avoid having to put a blank button on the entire Movie. After you register the mouse click, you can stop the Drag and immediately move the MC containing the blank button off the stage giving you access to the buttons underneath.


    Ex. You have a button called "BB". Place it in a MC called "tracker". Then in frame 1 of your movie, use the following command:

    Start Drag ("/tracker", lockcenter)

    This will lock the blank button inside the MC "tracker" to your mouse. Then when the user clicks, you capture it and do what you want.

    On (Press)
    Stop Drag
    End On
    On (Release)
    Begin Tell Target ("/")
    Go to and Stop (2)
    End Tell Target
    End On

    In Frame 2 you could place the following:

    Set Property ("/tracker", X Position) = 650

    Assuming your Movie is less than 600 pixels wide, this would move the tracker MC containing the blank button off the stage. You could then use your buttons underneath.

    If you need to have the buttons live all the time, then you will need to track the X/Y position of the "tracker" MC in a 2 frame "Monitoring" MC and based on that position, do the same action that the button under those coordinates would do. A little more complicated, but would allow you to accomplish what you want in Flash 4.

    Cheers,
    Markus B


  4. #4
    Junior Member
    Join Date
    Mar 2001
    Posts
    3
    if anyone has come here with the same problem i had, i now have a .fla which solves this little problem, with more than a llittle help from from MR MARKUS B. if you want the .fla, email me:

    dave@completelydigital.com

    and i'll send it to ya.

    rather than detecting a MOUSE PRESS, though, it detects changes in the _x and _y coordinates. which i figure is a just as valid way of detecting inactivity.

    it does this using an invisible MC attached to the pointer using a DRAG MOVIE command. this is used in conjunction with a "timer" MC which is reset when the mouse _x and _y coords change.

    it uses a series of frames that act as a loop which:
    on the first frame, sets the variable:
    "mouse_xs" = the x position of the dragged MC and
    "mouse_ys" = the y position of the dragged MC

    on the second frame sets the variable:
    "mouse_x" = the x position of the dragged MC and
    "mouse_y" = the y position of the dragged MC

    this gives us two sets of x and y coordinates, one set obtained shortly before the the other, which will let us know if mouse has moved (it may help to leave a couple of frames gap between the two)

    the next frame says if the two sets of y coords aren't the same to tell our timer to reset, otherwise go to the next frame.

    the next frame says if the two sets of x coords aren't the same to tell our timer to reset, otherwise go to the next frame.

    the next frame tells the timeline to start the loop again.

    and thats it.

    if you want the .fla just drop me a line at the email address above.

    hope this helps anyone who was in the same boat as i was.

    DAVE

  5. #5
    Registered User Bzdero's Avatar
    Join Date
    Feb 2001
    Location
    Split, Croatia
    Posts
    488
    It can be done this way:
    In first frame of your movie put:
    Set Variable: "/:time" = 1800
    Create movie clip with two frames (it can be empty) and in first frame put this:
    Set Variable: "/:time" = /:time - 1
    If (time <= 0)
    Begin Tell Target ("_level0")
    Go to and Stop ("intro")
    End Tell Target
    End If
    Then in every button you use put:
    Set Variable: "/:time" = 1800
    Don't forget to put this movie clip in every frame of your movie.
    (number 1800 if you use 12 fps. Formula is: 300 (seconds in 5 min) * frame rate/2 (every second frame has action).

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