home *** CD-ROM | disk | FTP | other *** search
/ LineOne ISP Sign-Up 5 / LineOne.iso / assets / cxt / scripts / movieScripts.cst / 00002_setupMain.ls < prev    next >
Encoding:
Text File  |  2001-01-27  |  2.3 KB  |  89 lines

  1. -- 2000.03.10
  2. -- Clive Green <clivegreen@atlas.co.uk>
  3.  
  4. ------------------------------------------------------------------------------------------------------
  5.  
  6. -- this sets up the programme and provides access to the main codebase object;
  7. -- it also relays glue calls to the codebase - including those made from (say) Flash movies
  8.  
  9. ------------------------------------------------------------------------------------------------------
  10.  
  11. -- declare globals:
  12. global gRoot -- the stub/projector's parent directory path
  13. global gMain -- a persistent reference to an object representing the entire programme 
  14.  
  15. ------------------------------------------------------------------------------------------------------
  16.  
  17. on setupMain
  18.   
  19.   -- called by startMovie:
  20.   
  21.   -- attempt to initialise the programme - supply the root path within an arguments listing:
  22.   m = new(script "main",[#rootPath:gRoot])
  23.   
  24.   -- any luck?
  25.   if (ilk(m) <> #instance) then
  26.     
  27.     beep 3--DEV
  28.     exit
  29.     
  30.   end if
  31.   
  32.   --------------------
  33.   
  34.   -- store main object:
  35.   gMain = m
  36.   
  37.   -- try for logo and feedback display windows -
  38.   -- note that we don't care about the result returned:  
  39.   gMain.showMiaws()
  40.   
  41.   -- check for existence of the correct CD-ROM:
  42.   gMain.checkForCDROM()
  43.   
  44.   ----------------------------------------------------------------------------------------------------
  45.   
  46. on clearMain
  47.   
  48.   -- called by stopMovie:
  49.   
  50.   -- clean up only as needed:
  51.   if (ilk(gMain) <> #instance) then return gMain
  52.   
  53.   --------------------
  54.   
  55.   -- any miaws (movies-in-a-window) will need to be dismissed:
  56.   gMain.clearMiaws()
  57.   
  58.   -- close all sound channels:
  59.   repeat with i = 1 to 8
  60.     
  61.     sound stop i
  62.     
  63.   end repeat
  64.   
  65.   ----------------------------------------------------------------------------------------------------
  66.   
  67. on glue g
  68.   
  69.   -- called from outside Director - relay the glue message g:
  70.   
  71.   -- codebase is required:
  72.   if (ilk(gMain) <> #instance) then return gMain
  73.   
  74.   --------------------
  75.   
  76.   -- relay the message:
  77.   L = gMain.glue(symbol(g))
  78.   
  79.   -- compile a string from the result returned:
  80.   s = g & ":" && string(L)
  81.   
  82.   -- print feedback string:
  83.   um = gMain.getUtilityMethods() 
  84.   um.printStr(s)
  85.   
  86.   -- provide a result to the caller:
  87.   return L
  88.   
  89.   ----------------------------------------------------------------------------------------------------