Director News
Director Web Sites
Mailing Lists
News Groups
Project Examples
Useful Web Sites

Don't miss these
Text Member Menu System
Mile High Table O'Products
Writing text to the user's drive
goMail LDM
Sharpen Filter - Imaging Lingo
Rotate Click-Alphamania
zWinVer Xtra
Popup Score
ProMix Xtra for Authorware and Director
Audio Xtra



Behavior Gallery navigator

Added on 6/27/2004


D8 D8_5 D9 Mac PC

This item has not yet been rated

Author: Raschko

This script will cycle through a list of images based on a back or next button. It is very easy to implement; some naming conventions need apply.

Download PC Source
-- 27 June 2004, written By Brian Raschko

-- Variables -- globals.
global   myName
global   secondName
global   maxNum

global   ammount
global   tracker
global   recall
-- Variables -- Property Box specific.
Property description
property spriteNum
property mySprite

property myDownMember
property myStandardMember

property myCounter
property myThumbnail
property myControl

-- Main Scripts --

on beginSprite me
  myName = member(sprite(myThumbnail).member).name
  mySprite = sprite(me.spriteNum) -- Determine the Sprite for this Button.
  myStandardMember = mySprite.member -- Determine the default Member for this Button.
  if myControl = "Next" then
    findMaxNumber -- search a cast for instances of a member
  end if
end beginSprite

on mouseDown me
  mySprite.member = myDownMember -- Flip this button to the MouseDown Member.
  case myControl of
      if integer(member(myCounter).text) <> maxNum then -- stop if
        member(myCounter).text = string(integer(member(myCounter).text) + 1) -- increase the counter
      end if
      if integer(member(myCounter).text) <> 1 then -- stop if
        member(myCounter).text = string(integer(member(myCounter).text) - 1) -- decrease the counter
      end if
  end case
  sprite(myThumbnail).member = member(secondName & member(myCounter).text) -- change to another thumbnail view
end mouseDown

on mouseUp me
  mySprite.member = myStandardMember -- Flip this button to the Default Member.
end mouseLeave

on mouseLeave me
  mySprite.member = myStandardMember -- Flip this button to the Default Member.
end mouseLeave

on findMaxNumber
  maxNum = 0 -- initialize the counter
  secondName = myName -- create a copy of the member name
  myCast = sprite(myThumbnail).castLibNum -- which cast do I reside in
  ammount = the number of members of castLib(myCast) -- number of members in said cast (legacy code)
  recall = the itemDelimiter      -- capture the base item spepperator
  the itemDelimiter = "_"         -- change the item sepperator
  myName = myName.item[2]         -- grab the second item of the member name
  secondName = secondName.item[1] -- grab the first item of the member name
  the itemDelimiter = recall      -- reset the item sepperator
  repeat with tracker = member(sprite(myThumbnail).member).membernum to ammount --repeat to the contents of the cast
    if member(tracker).name contains myName then -- compare member names
      maxNum = maxNum + 1  -- increase the counter value  
    end if
  end repeat
  secondName = secondName & "_" & myName & "_" -- reset the membername after being choped up

-- Property "Pop-Up" Functions --

on isOKToAttach (me, aSpriteType, aSpriteNum) -- What am I attached to?
  case aSpriteType of
      return TRUE -- I can be attached to that. ( graphic = attached to a sprite )
      return FALSE -- You can't attach ME to that!
  end case
end isOKToAttach

on getPropertyDescriptionList -- Open the Property "Pop-Up" Box.
  if the currentSpriteNum = 0 then exit -- Quit installation if not on the Timeline or a Sprite.
  theMember = sprite(mySprite).member --|__ My member Number
  theMemberNumber = theMember.number  --|
  description = [:] -- Declare the Property Variable Array.
  -- Add the Property Vairables.
  addprop description,#myDownMember, [#comment: "Display which member on MouseDown?",#format: #graphic, #default: member (theMemberNumber + 1)                 ]
  addprop description,#myControl,    [#comment: "Type of control?",                  #format: #string , #default: "Next", #range: ["Next", "Back"]             ]
  addprop description,#myThumbnail,  [#comment: "Sprite to change?",                 #format: #integer, #default: 1, #range: [#min: 1, #max: the lastChannel ] ]
  addprop description,#myCounter,    [#comment: "Display the image number where?",   #format: #field ,  #default: "URL"                                        ]
  -- Display these Variables.
  return description
end getPropertyDescriptionList

-- Script Description --

on getBehaviorDescription me
  "Thumbnail companion:" & RETURN & RETURN &
  "Parameters: " & RETURN &
  "    *Button states:" & RETURN &
  "       - Down" & RETURN &
  "    *Image number indicator." & RETURN &
  "    *What sprite to change." & RETURN & RETURN &
  QUOTE & "This scripte requires a text sprite as wel as" & RETURN &
  "two buttons; back and next. In comparison" & RETURN &
  "you can think of it as database navigation, if" & RETURN &
  "you have delt with this sort of a thing." & QUOTE & RETURN & RETURN &
  QUOTE & "In enabling this script we need to use specific naming conventions; almost like an" & RETURN &
  "array of sorts. For example..." & RETURN & RETURN &
  "number_name_number" & RETURN & RETURN &
  "The last number corrisponds to the variable inside the text member. Hence counting" & RETURN &
  "through your images." & RETURN & RETURN &
  "1_BLAH_1 , 1_BLAH_2 , 1_BLAH_3....ETC" & QUOTE
end getBehaviorDescription



36 South Court Sq
Suite 300
Newnan, GA 30263

Send e-mail