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
XTRA dmmScript for scripting
Set WarpMode of a QTVR Sprite
Text Outliner
goMU LDM
ToolTips for Shockwave 3D
Time Difference
Sarah"s Multiuser Pages
Font Pages
Magnify-Alphamania
Round floating point numbers off to nearest ten
 

 

 

Behavior Set Color properties of a vector cast member

Added on 6/13/2000

 

Compatibilities:
behavior D7 D8 Mac Shockwave

This item has not yet been rated

Author: KumarK

Set Color properties of a vector cast member

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

--- Custom Properties ---
property sourcemember,WhereTo,FillR,FillG,FillB,BgR,BgG,BgB,fillmode,Gradtype

--- Get Behavior Description List ---
on getPropertyDescriptionList me
  VectorMembersList=searchVectorMember (me)
  descriptionlist = [:]
  spriteassignlist=["Mouse Up","Mouse Down", "Mouse Enter","Mouse Leave"]
  frameassignlist=["Exit Frame","Enter Frame"]
  if VectorMembersList.count > 0 then
    addprop descriptionlist,#sourcemember,[#comment:"Source Vector Shape Cast member :",  \
    #format:#String,#range:VectorMembersList,#default:VectorMembersList[1]]
  else
    addprop descriptionlist,#sourcemember,[#comment:"Source Vector Shape Cast member :",#format:#Graphic,#default:1]
  end if
  addprop descriptionlist,#fillmode,[#comment:"Set FillMode to :",#format:#String,#range:["Solid","Gradient","None"],#default:"Solid"]
  addprop descriptionlist,#Gradtype,[#comment:"Select Gradient Type :",#format:#string,#range:["Linear","Radial"],#default:"Linear"]
  addprop descriptionlist,#BgR,[#comment:"Backround Color(Red Value) :",#format:#Integer,#range:[#min:0,#max:255],#default:50]
  addprop descriptionlist,#BgG,[#comment:"Backround Color(Green Value) :",#format:#Integer,#range:[#min:0,#max:255],#default:50]
  addprop descriptionlist,#BgB,[#comment:"Backround Color(Blue Value) :",#format:#Integer,#range:[#min:0,#max:255],#default:50]
  addprop descriptionlist,#FillR,[#comment:"Fill Color(Red Value) :",#format:#Integer,#range:[#min:0,#max:255],#default:50]
  addprop descriptionlist,#FillG,[#comment:"Fill Color(Green Value) :",#format:#Integer,#range:[#min:0,#max:255],#default:50]
  addprop descriptionlist,#FillB,[#comment:"Fill Color(Blue Value) :",#format:#Integer,#range:[#min:0,#max:255],#default:50]
  if the currentspritenum <> 0 then
    addprop descriptionlist, #WhereTo, [#comment:"Where To Assign this Script ?", #format:#String,#range:spriteassignlist,#default:spriteassignlist[1]]
  else
    addprop descriptionlist, #WhereTo, [#comment:"Where To Assign this Script ?", #format:#String,#range:frameassignlist,#default:frameassignlist[2]]
  end if  
  return descriptionlist
end getPropertyDescriptionList
--- Get Behavior Description List ---


-- Get Behavior description --
on getBehaviorDescription
  return "This Behavior Sets the Color properties of a Vector Graphics member  " & RETURN & RETURN & \
  "Parameters" & RETURN & \
  "* Source Vector Cast member." & RETURN & \
  "* FillMode." & RETURN & \
  "* Fradient Type(If FillMode is Gradient)." & RETURN & \
  "* RGB Value for  BackgroundColor." & RETURN & \
  "* RGB Value for  FillColor." & RETURN & \
  "* Where to attach this Script"
end
-- Get Behavior description --

-- events --
on mouseUp me
  if WhereTo="Mouse Up" then
    SetColorprop
  end if
end

on mouseDown me
  if WhereTo="Mouse Down" then
    SetColorprop
  end if
end

on mouseEnter me
  if WhereTo="Mouse Enter" then
    SetColorprop
  end if
end

on mouseLeave me
  if WhereTo="Mouse Leave" then
    SetColorprop
  end if
end

on enterframe
  if WhereTo="Enter Frame" then
    SetColorprop
  end if
end

on ExitFrame
  if WhereTo="Exit Frame" then
    SetColorprop
  end if
end
-- events --

-- custom handlers --
on SetColorprop
  if member(sourcemember).type = #vectorShape then
    case fillmode of
      "Solid":member(sourcemember).fillMode=#solid
      "Gradient":member(sourcemember).fillMode=#Gradient  
      "None":member(sourcemember).fillMode=#None
    end case
    if member(sourcemember).fillMode=#Gradient then
      case Gradtype of
        "Linear":member(sourcemember).gradientType=#linear
        "Radial":member(sourcemember).gradientType=#Radial
      end case
    end if
    member(sourcemember).backgroundColor= rgb(BgR,BgG,BgB)
    member(sourcemember).fillcolor= rgb(FillR,FillG,FillB)    
  end if
end
-- custom handlers --
------ Availbale for both Frame & Sprite Script ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return true
    #script:
      return True
  end case
end isOKToAttach
------ Availbale for both Frame & Sprite Script ------

------ Search for Vector Member ------
on searchVectorMember me
  VectorMembersList = []
  maxCastLib = the number of castLibs
  repeat with theCastLib = 1 to maxCastLib
    maxMember = the number of members of castLib theCastLib
    repeat with memberNumber = 1 to maxMember
      theMember = member(memberNumber, theCastLib)
      if theMember.type = #vectorShape then
        if theMember.name = EMPTY then
          VectorMembersList.append(theMember)
        else
          VectorMembersList.append(theMember.name)
        end if
      end if
    end repeat
  end repeat
  return VectorMembersList
end
------ Search for Vector Member ------  

 


Contact

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

Send e-mail