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
3D Rotation
Sprite recorder v.2
bubbleSortForStrings AND bubbleSortForStringLists
Rollover Sound
RoboHelp 5 Review
Fill using setPixel
Macromedia User Groups (MMUG)
Navegacion y colision 3d - 3d Collision Navigation
Set DirectToStage Property of a Flash Sprite
Check QuickTime Version
 

 

 

Behavior Set the ink of Sprite

Added on 6/6/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: KumarK

Sets the ink of a sprite

---- written for Director 8 ---
---- Kumar.K ----
---- kumark@icode.com ----
------ Custom Properties ------

property WhichSprite,InkProp,WhereTo

-- Get Behavior Parameters --
on getPropertyDescriptionList
  set description = [:]  
  set inklist =["Copy","Transparent","Reverse","Ghost", "Not copy","Not transparent","Not reverse","Not ghost",
   "Matte","Mask","Blend","Add pin","Add","Subtract pin","Background transparent","Lightest","Subtract",
  "Darkest","Lighten","Darken"]  
  addProp description, #WhichSprite, [#format:#Integer, #comment: "Which Sprite ?", #default:1,
  #range:[#Min:1,#Max:the lastchannel]]
  addProp description, #InkProp, [#format:#String, #comment: "Set the Ink of Sprite to :",
   #range:inklist,#default:inklist[1]]
  if the currentspritenum = 0 then
    addProp description, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String,
    #range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
  else
    addProp description, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String,
    #range:["On MouseUp","On MouseDown","On MouseEnter","On MouseLeave"],#default:"On MouseUp"]    
  end if      
  return description
end

-- Can be attached to both Sprite and Frame Scripts --
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return True
    #script:
      return True
  end case
end isOKToAttach

-- Get Behavior description --
on getBehaviorDescription
  return "This Behavior Controls Ink Property of a  Sprite." & RETURN & RETURN &
  "Parameters" & RETURN &
  "*Sprite Number." & RETURN &
  "* Ink Type." & RETURN &
  "* Where to attach this Script"
end

-- Events --
on EnterFrame me
  if WhereTo = "On EnterFrame" then
    controlInkProp
  end if
end EnterFrame

on ExitFrame me
  if WhereTo = "On EnterFrame" then
    controlInkProp
  end if
end ExitFrame

on MouseUp
  if WhereTo = "On MouseUp" then
    controlInkProp
  end if
end MouseUp

on MouseDown
  if WhereTo = "On MouseDown" then
    controlInkProp
  end if
end MouseDown

on MouseEnter
  if WhereTo = "On MouseEnter" then
    controlInkProp
  end if
end MouseEnter

on MouseLeave
  if WhereTo = "On MouseLeave" then
    controlInkProp
  end if
end MouseLeave

-- Custom Handler to Control Ink Type of a Sprite --
on controlInkProp
  case InkProp of
    "Copy":sprite(WhichSprite).ink=0
    "Transparent":sprite(WhichSprite).ink=1
    "Reverse":sprite(WhichSprite).ink=2
    "Ghost":sprite(WhichSprite).ink=3
    "Not copy":sprite(WhichSprite).ink=4
    "Not transparent":sprite(WhichSprite).ink=5
    "Not reverse":sprite(WhichSprite).ink=6
    "Not ghost":sprite(WhichSprite).ink=7
    "Matte":sprite(WhichSprite).ink=8
    "Mask":sprite(WhichSprite).ink=9
    "Blend":sprite(WhichSprite).ink=32      
    "Add pin":sprite(WhichSprite).ink=33
    "Add":sprite(WhichSprite).ink=34
    "Subtract pin":sprite(WhichSprite).ink=35
    "Background transparent":sprite(WhichSprite).ink=36
    "Lightest":sprite(WhichSprite).ink=37
    "Subtract":sprite(WhichSprite).ink=38
    "Darkest":sprite(WhichSprite).ink=39
    "Lighten":sprite(WhichSprite).ink=40
    "Darken":sprite(WhichSprite).ink=41  
  end case  
  updatestage
end
-- Custom Handler to Control Ink Type of a Sprite --

 


Contact

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

Send e-mail