Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Dialogs - Tell Me Something
Movie Slider Control
How to Use Macromedia Flash 5
Cursor trails
Elliptical Sprite Behavior
Hyper Midi
Vector Shape - Create Square Wave
Universal serial port behavior
Director Online
3D, Lingo, Director Forums
MediaMacros Xtras Mall
 

 

 

Behavior Display the cursors position

Added on 10/9/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

Rating:

Author: KurtKoenig (website)

A behavior that displays the cursors position while the cursor is over the stage. It also has a few options

Download PC Source    Download Mac Source
--------- DISPLAY CURSORPOSITION ____________________________________________________________
--___________________________________________________________________________________________
--
--  This behavior shows the cursors position in a field on mousedown,
--  or else on enterframe. With an option to change the fields backcolor
--  when the mouse is down. Use this behavior in the scriptchannel, or
--  drop it on a sprite, or the stage.
--  
--  10/07/2000                       Kurt Koenig * Belgium
--                                  
--                                   New E-mailaddress: k.k@pi.be
--
--____________________________________________________________________________________________

----------------------------------------------------------------------------------------------


property pMousePos,
property pTheField
property pSW, pSH
property pFieldCol
property pOldCol
property pNewCol
property pWhatAction

on getPropertyDescriptionList
  desclist = [:]
  
  addprop desclist, #pTheField,[#comment:¬
"Display the cursor position in which field:", ¬
  format: #field , default: ""]
  addprop desclist, #pFieldCol,[#comment:¬
"Change the fields backcolor on mousedown ?:", ¬
  format: #Boolean , default: FALSE]
  addprop desclist, #pNewCol,[#comment:¬
  "Change the fields backcolor to which color (0-255) ?:", ¬
  #default:5, #format:#integer, #range:[#min:0,#max:255]]
  addprop desclist, #pWhatAction, [ #comment:¬
  "Display cursor position on which action?", ¬
  #format: #symbol, #range:[#Enterframe, #Mousedown],¬
  #default: #Mousedown]
  
  return desclist
end getPropertyDescriptionList



on getBehaviorDescription
  return " This behavior shows the cursors position in a field on"&return&" ¬
mousedown, or else on enterframe. With an option to"&return&" ¬
change the fields backcolor when the mouse is down."&return&" ¬
Use this behavior in the scriptchannel, or drop it on a"&return&" ¬
sprite, or the stage."&return&"¬
                                    Kurt Koenig * Belgium"
end getBehaviorDescription



on getBehaviorTooltip me
  return "This behavior shows the"&return&"¬
cursors position in a field."
end getBehaviorTooltip


-- Store the stagedimension and the fields backcolor.
on beginsprite
  pOldCol = (pTheField).backcolor
  pSH =  the stageBottom - the stageTop
  pSW =  the stageright - the stageleft
end beginsprite



on enterFrame
  gMousePos = the mouseloc
  if pWhatAction = #enterFrame or pWhatAction = #mousedown then
    doIt
  end if
end


--Hold on the frame
on exitframe
  go the frame
end exitframe


on doIt
  if pWhatAction = #enterFrame then
    option1
  else
    if pWhatAction = #mousedown then
      option2
    end if
  end if
end


-- When enterframe is selected in the parameterwindow...
on option1
  --Clear the field when the mousecursor is not over the stagewindow.
  if the mouseH < pSW - pSW or the mouseH > pSW¬
      or the mouseV < pSH - pSH or the mouseV > pSH then
    put "" into field pTheField
    -- Restore the fields color.
    (pTheField) . backcolor = pOldCol
  else
    -- If the option to change the fieldcolor
    -- is checked in the parameterwindow.
    if pFieldCol then
      -- Use the NewColor for the field when the mousecursor is over the stage.
      (pTheField). backcolor = pNewCol
      pMousePos = the mouseloc
      put "H"&&pMousePos[1]&&"V"&&pMousePos[2] into field pThefield
      updatestage
    end if
  end if
end option1


-- When mousedown is selected in the parameterwindow...
on option2
  repeat while the mousedown
    --Clear the field when the mousecursor is not over the stagewindow.
    if the mouseH < pSW - pSW or the mouseH > pSW¬
      or the mouseV < pSH - pSH or the mouseV > pSH then
      put "" into field pTheField
      -- Restore the fields color.
      (pTheField) . backcolor = pOldCol
    else
      -- If the option to change the fieldcolor
      -- is checked in the parameterwindow.
      if pFieldCol then
        -- Use the NewColor for the field when the mousecursor is over the stage.
        (pTheField). backcolor = pNewCol
        pMousePos = the mouseloc
        put "H"&&pMousePos[1]&&"V"&&pMousePos[2] into field pThefield
        updatestage
      end if
    end if
  end repeat
end option2


-- Clear the field and restore the fields backcolor when the mousebutton is released.
on mouseup
  (pTheField) . backcolor = pOldCol
  put "" into field pTheField
end mouseup

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail