unlinks linked members; turns into internal members

Date: Thu Sep 24 11:54:48 MST 1998
From: Loren Mork <LMork@aol.com>
Subject:  Convert linked members into internal members
on FixCastLinks
  
  ---------------------------------------------------------------------------- 
  -- v2. Commented 12/17/97  Lmork@aol.com
  -- unlinks externally linked casts
  -- In this version, only linked bitmaps are affected
  -- and there is no need for a list of member names
  -- as in the  earlier version
  ---------------------------------------------------------------------------- 
    
  -- determine number of members in cast, the activecast
  set memnumber = the number of members of castlib the activecastlib
    
  -- x runs through all the cast  
  repeat with x = 1 to memnumber
       
    -- filter the castmembers so that only bitmaps are affected   
    if the type of member x = #bitmap then
      
      -- filter the bitmaps so that only bitmaps that have an external
      -- filename, ie "linked" bitmaps, are affected 
      if the filename of member x = "" then next repeat
      
      -- get the current cast members registration point, so it can 
      -- be transferred onto the incoming  new bitmap
      set myreg =  the regPoint of member x
     
      
      -- Need to make sure the member imported comes in with
      -- the correct palette;
      -- setting the palette of member does not seem to work.
      -- So instead set the palette of the main movie, when importing, 
      -- to the correct palette (the member to be imported's palette);
      -- the member imported will import to that palette by default. 
      -- Tried to import various other ways,they didn't work
      -- (the puppetpalette needs one tick to work)
      puppetpalette the palette of member x,1
      updatestage
      
      -- get the name of the member that will be affected
      -- so that it can be renamed if it is different than
      -- the actual filename
      set mycastname = the name of member x
            
      -- import in the new members unlinked
      -- NOTE: import in as:
      -- importfileinto the member number, membername
      -- does not work as:
      -- importfileinto membername, membername
      -- because some names are the same, 
      -- really wierd stuff happens
      importFileInto member  x, the filename of member x
      
      
      -- rename the new member to what it was before
      set the name of member x = mycastname
      
      -- set the registration point of the new member
      set the regpoint of member x = myreg
            
    end if
  end repeat