home *** CD-ROM | disk | FTP | other *** search
/ LineOne ISP Sign-Up 5 / LineOne.iso / assets / cxt / scripts / parentScripts.cst / 00077_navigationService parent.ls < prev    next >
Encoding:
Text File  |  2001-01-27  |  4.2 KB  |  138 lines

  1. -- 2000.02.26
  2. -- Clive Green <clivegreen@atlas.co.uk>
  3.  
  4. ------------------------------------------------------------------------------------------------------
  5.  
  6. -- this provides some (very) basic navigation features.
  7.  
  8. ------------------------------------------------------------------------------------------------------
  9.  
  10. -- declare properties:
  11. property main          -- main code directory object
  12. property flashFrameLog -- a linear list of locations visited in the current session
  13. property menuSuffix    -- a frameLabel suffix string used to identify flash menu screens
  14. property conditions    -- a list of descriptions for conditional behaviour
  15. property outcomes      -- a list showing all courses of action resulting from one or more conditions
  16.  
  17. ------------------------------------------------------------------------------------------------------
  18.  
  19. on new me,L
  20.   
  21.   -- (1) extract and check arguments:
  22.   
  23.   -- check for a parameter list:
  24.   if ilk(L) <> #propList then return [#error:#noParamListSupplied, #msg:"navigationService:new"]
  25.   
  26.   -- a reference to the parent codebase is REQUIRED:
  27.   main = L[#main]
  28.   if (ilk(main) <> #instance) then return [#error:#noMainObjectSupplied, #msg:"navigationService:new"]
  29.   
  30.   --------------------
  31.   
  32.   -- initialise the list of visited flash frames - this gets used to inform the operation of the
  33.   -- goBack method:
  34.   flashFrameLog = []
  35.   
  36.   --------------------
  37.   
  38.   -- obtain known settings:
  39.   dm = main.getDataManager()
  40.   sL = dm.getData([#set:#settings])
  41.   
  42.   -- what suffix string do flashMenu framelabels have?
  43.   menuSuffix = sL[#flashMenu][#frameLabelSuffix]
  44.   
  45.   --------------------
  46.   
  47.   -- pass back my address:
  48.   return me
  49.   
  50.   ----------------------------------------------------------------------------------------------------
  51.   
  52. on goBack me
  53.   
  54.   -- are there any previously visited locations in the current session? We need at least two entries
  55.   -- in the frame log, because the final one is the CURRENT location, while the PENULTIMATE one is
  56.   -- the one we want to return to...
  57.   
  58.   -- check eligibility:
  59.   c = count(flashFrameLog)
  60.   if c < 2 then return [#error:#cantGoBackAnyFurther, #message:"navigationService:goBack"]
  61.   
  62.   --------------------
  63.   
  64.   -- get the previous logged location:  
  65.   L = flashFrameLog[c-1]
  66.   
  67.   -- delete the latest ( = current) logged location:  
  68.   deleteAt(flashFrameLog,c)
  69.   
  70.   -- add the flashMenu suffix (to avoid normal transitional animations):
  71.   L[#suffix] = menuSuffix
  72.   
  73.   -- flag backwards movement as a parameter:
  74.   L[#direction] = #backwards
  75.   
  76.   -- go to the previous location:
  77.   me.goFlashFrame(L)
  78.   
  79.   ----------------------------------------------------------------------------------------------------
  80.   
  81. on doQuit me
  82.   
  83.   -- (this implicitly invokes the application call: "stopMovie:clearMain"):
  84.   quit
  85.   
  86.   ----------------------------------------------------------------------------------------------------
  87.   
  88. on goFlashFrame me,L
  89.   
  90.   -- basic flash movie navigation:
  91.   
  92.   --------------------
  93.    
  94.   -- check for parameter listing:
  95.   if ilk(L) <> #propList then return [#error:#e1033]
  96.   
  97.   -- extract flash sprite number:
  98.   s = L[#flashSprite]
  99.   if voidP(s) then return [#error:#e1034]
  100.   
  101.   -- must be an integer!
  102.   if not integerP(s) then return [#error:#e1037]
  103.    
  104.   -- must be a positive number!
  105.   if s < 1 then return [#error:#e1038]
  106.    
  107.   -- check flash sprite exists:
  108.   if (sprite(s).member).type <> #flash then return [#error:#e1028]
  109.   
  110.   -- check flash frameLabel provided:
  111.   f = L[#frameLabel]
  112.   if voidP(f) then return [#error:#e1035]
  113.   
  114.   -- does this frameLabel exist?
  115.   if not findLabel(sprite s,f) then return [#error:#e1036, #msg:"frameLabel =" && f]
  116.   
  117.   --------------------
  118.   
  119.   -- use suffix if one is supplied:
  120.   ss = L[#suffix]
  121.   if stringP(ss) then f = f & ss
  122.   
  123.   -- branch to and play from the frame label f WITHIN the flash sprite s:
  124.   goToFrame(sprite s,f)
  125.   play sprite s
  126.   
  127.   --------------------
  128.   
  129.   -- log current location (except when moving backwards):
  130.   d = L[#direction]
  131.   if (d <> #backwards) then add flashFrameLog,L
  132.   
  133.   -- clear the cursor:
  134.   sm = main.getServiceManager()
  135.   cs = sm.getService(#cursorService)
  136.   cs.clearCursor()
  137.   
  138.   ----------------------------------------------------------------------------------------------------