Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Set PausedAtStart Property of a Flash member
Thumbnail Browser
Lissajous Motion
Real-time Interactive 3D Games: Creating 3D Games in Macromedia Director 8.5 Shockwave Studio
FADER
Font Freak
SplashScreenX Pro
Lingo in a Nutshell
Icon Forge
cXtraPieChart
MediaMacros Xtras Mall
 

 

 

Behavior Importing Externally Linked (sound&bitmap) Files

Added on 6/20/2000

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: KumarK

Importing Externally Linked (sound&bitmap) Files

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

Property whereTo,filesize

------ Get Behavior Description List ------
on getPropertyDescriptionList me
  set description = [:]
  if the currentspritenum = 0 then
    addProp description, #filesize, [#comment: "Choose the FileSize Limit of the file to be imported(in KB) :",#format:#Integer,#range:[#min:1,#max:2048],#default:1024]    
    addProp description, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String,#range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
  else
    addProp description, #filesize, [#comment: "Choose the FileSize Limit of the file to be imported(in KB) :",#format:#Integer,#range:[#min:1,#max:2048],#default:1024]    
    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 getPropertyDescriptionList
------ Get Behavior Description List ------

-- Get Behavior description --
on getBehaviorDescription me
  return
    "Importing Externally Linked Files" & RETURN & RETURN &
    "This Behavior Imports all Externally Linked Files whose size are lesser or equal to filesize limit specified." & RETURN & RETURN &
  "PARAMETERS:" & RETURN &
    "* FileSize Limit" & RETURN &
    "* Where To assign this Script."
end getBehaviorDescription
-- Get Behavior description --

------ Availbale for both Frame and Sprite Script ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return true
    #script:
      return true
  end case
end isOKToAttach
------ Availbale for both Frame and Sprite Script ------

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

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

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

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

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

on MouseLeave
  if WhereTo = "On MouseLeave" then
    ImportLinkedFiles
  end if
end MouseLeave
------ Events ------

--- Custom Handler to Import Files ---
on ImportLinkedFiles
  repeat with i=1 to the number of castlibs
    repeat with j=1 to the number of members of castlib i
      set themember = member j of castlib i
      set filepath = the filename of themember
      if filepath <> EMPTY then
        set size = member(themember).size/1024.0
        case(the type of themember) of
          #bitmap,#sound:
            if size > 0 and size <=filesize  then
              set oldname = the name of themember
              importFileinto(themember,filepath)
              set the name of themember = oldname
            end if
        end case
      end if
    end repeat
  end repeat
end
--- Custom Handler to Import Files ---

 


Upload Provided by ABCUpload ASP

Contact

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

Fax - (206) 339-5833

Send e-mail