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
Snap Shot Maker
Text Services API
CPS Audio/MIDI Xtra
Set Cast member Properties of a QuickTime
StreamStatus Indicator Bar
Delet an Existing File
Shockwave Stand Alone Installer
Doutone-Alphamania
Convert Decimal to Comma (EU)
Popup Menu ActiveX Control
 

 

 

Behavior Install font

Added on 6/12/2000

 

Compatibilities:
behavior D7 D8 PC

Required Xtras:
Buddy API

This item has not yet been rated

Author: KumarK

Install Font

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

-- custom properties --
property soundchannel,WhereTo,folderlist,theFile,subfolders,fileslist,result,fontname


------ Get Behavior Description List ------
on getPropertyDescriptionList me
  set description = [:]
  filelist=getfilelist(me)
  if   filelist.count > 0 then  
    addProp description, #theFile, [#comment: "Select the Font you want to install :", #format:#String,#range:filelist,#default:filelist[1]]
    addProp description, #fontname, [#comment: "Enter Name of the Font here :", #format:#String,#default:"Enter Nmae of the Font"]    
    if the currentspritenum = 0 then
      SetaProp description, #WhereTo, [#comment: "Where To Attach" ,#format:#String, \
    #range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
    else
      SetaProp description, #WhereTo, [#comment: "Where To Attach" ,#format:#String, \
    #range:["On MouseUp","On MouseDown","On MouseEnter","On MouseLeave"],#default:"On MouseUp"]    
    end if    
    return description
  else
    alertme
  end if
end getPropertyDescriptionList
------ Get Behavior Description List ------

-- Get Behavior description --
on getBehaviorDescription
  return "This Behavior Installs the Selected Font. " & RETURN & RETURN &\
  "Make sure you have the font be installed in current folder or subfolders upto level 2. " & RETURN & RETURN &\
  "This Behavior Requires Buddy API to Get filenames,so please make sure uyou have Buddy API Xtra. " & RETURN & RETURN &\
  "Parameters" & RETURN & \
  "* File Name" & RETURN & \
  "* Font Name" & RETURN & \
  "* Where to attach this script"
end
-- Get Behavior description --

------ Can be attached to only Script Channel ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #script:
      return true
    #graphic:
      return true      
  end case
end isOKToAttach
------ Can be attached to only Script Channel ------

-- give alert message --
on alertme
  alert "No Font Files Found"
end
-- give alert message --

--- search for soundfile ---
on getfilelist me
  set mypath=the moviepath
  set fileslist=[]
  set Folders = baFolderList( mypath )
  set Files = baFileList( mypath ,"*.*")
  
  repeat with M=1 to Files.count
    findext files[m]    
    if (result=true) then
      fileslist.append(files[m])
    end if
  end repeat
  repeat with i = 1 to folders.count
    set subfolders = baFolderList( mypath & "\" & folders[i])
    if subfolders.count <> 0 then
      repeat with j=1 to subfolders.count
        set Files = baFileList( mypath & " \" &  folders[i] & "\" & subfolders[j],"*.*")
        repeat with k=1 to Files.count
          findext files[k]    
          if (result=true) then  
            fileslist.append(folders[i] & "\" & subfolders[j] & "\" & files[k])
          end if
        end repeat
      end repeat
      set Files = baFileList( mypath & " \" &  folders[i],"*.*")    
      repeat with j=1 to Files.count
        findext files[j]    
        if (result=true) then          
          fileslist.append(folders[i] & "\" & files[j])
        end if
      end repeat    
    else
      set Files = baFileList( mypath & " \" &  folders[i],"*.*")
      repeat with j=1 to Files.count
        findext files[j]    
        if (result=true) then
          fileslist.append(folders[i] & "\" & files[j])
        end if
      end repeat
    end if      
  end repeat
  return fileslist
end
--- search for soundfile ---

--- find out extension --
on findext source
  result=chars(source,the length of source - 3,the length of source)
  if result=".ttf" or result=".Pfb" or result= ".au" or  result = ".pfm" or  result = ".fon" then
    result=true
  else
    result=false
  end if
  return result
end if
end findnext
--- find out extension --


---Install Font --
on Installfont
set OK = baInstallFont(theFile , fontname  )
end
---Install Font --

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

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

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

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

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

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

 


Contact

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

Send e-mail