Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Authoring Xtras
Generic MP3 Player
Vdig Xtra for Windows by Abstract Plane
zOpen
password field
file browser
Wait for DigitalVideo End
Multi lists sorting
Puzzler
Xplode that text
MediaMacros Xtras Mall
 

 

 

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

 


Upload Provided by ABCUpload ASP

Contact

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

Fax - (206) 339-5833

Send e-mail