Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Tree View
Fuel
E-mailExec 2.01
Shiver With Sound
RADStingList (Free Version)
SetMouseLoc Xtra
Append a File
import and play sound file (during runtime)
Installer
Halo around images
 

 

 

Behavior Copy Text - Non Editable Fields & Shockwave

Added on 11/16/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

This behavior, when placed on a NON-EDITABLE filed will allow the user to select and copy the text to the clipboard. This also works in Shockwave.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)

property spriteNum, startChar, endChar

global currentField

on mouseDown me
  sendAllSprites(#clearSelection)
  cursor 1
  currentField = spriteNum
  startChar = the mouseChar
  endChar = the mouseChar
  (the actorList).add(me)
end

on stepFrame me
  if endChar <> the mouseChar then
    endchar = the mouseChar
    if endChar > startChar then
      sprite(spriteNum).member.char[startChar..endChar].hilite()
    else if endChar < startChar then
      sprite(spriteNum).member.char[endChar..startChar].hilite()
    else
      theLines = sprite(spriteNum).member.line.count
      sprite(spriteNum).member.line[theLines + 1].hilite()
    end if
  end if
end

on mouseUp me
  cursor -1
  if endChar > startChar then
    sprite(spriteNum).member.char[startChar..endChar].hilite()
  else if endChar < startChar then
    sprite(spriteNum).member.char[endChar..startChar].hilite()
  else
    theLines = sprite(spriteNum).member.line.count
    sprite(spriteNum).member.line[theLines + 1].hilite()
  end if
  if (the actorList).getOne(me) <> 0 then
    (the actorList).deleteOne(me)
  end if
end

on mouseUpOutside me
  cursor -1
  if endChar > startChar then
    sprite(spriteNum).member.char[startChar..endChar].hilite()
  else if endChar < startChar then
    sprite(spriteNum).member.char[endChar..startChar].hilite()
  else
    theLines = sprite(spriteNum).member.line.count
    sprite(spriteNum).member.line[theLines + 1].hilite()
  end if
  if (the actorList).getOne(me) <> 0 then
    (the actorList).deleteOne(me)
  end if
end

on copySelected me
  if startChar < endChar then
    theSelection = sprite(spriteNum).member.char[startChar..endChar]
  else
    theSelection = sprite(spriteNum).member.char[endChar..startChar]
  end if
  --create temp member
  tempMember = new(#field)
  tempmember.text = theSelection & " "
  copyToClipboard tempMember
  erase tempMember
end

on clearSelection me
  theLines = sprite(spriteNum).member.line.count
  sprite(spriteNum).member.line[theLines + 1].hilite()
end

on endSprite me
  if (the actorList).getOne(me) <> 0 then
    (the actorList).deleteOne(me)
  end if
end

on getBehaviorDescription me
  describe = "This behavior alows non-editable field members to copy text to the clipboard. This is not a variable, it actually writes to the Mac/Windows clipboard so the data is available to other fields as well as other programs." & return
  describe = describe & "Note- this will only work with field members, not text members. Also note that using command/Ctrl + C in authoring mode will not work, as Director will intercept these events."
  describe = describe & return & "Call the copy function using... sendSprite(x, #copySelected)"
  return describe
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail