home *** CD-ROM | disk | FTP | other *** search
- -- 2000.02.26
- -- Clive Green <clivegreen@atlas.co.uk>
-
- ------------------------------------------------------------------------------------------------------
-
- -- this provides some (very) basic navigation features.
-
- ------------------------------------------------------------------------------------------------------
-
- -- declare properties:
- property main -- main code directory object
- property flashFrameLog -- a linear list of locations visited in the current session
- property menuSuffix -- a frameLabel suffix string used to identify flash menu screens
- property conditions -- a list of descriptions for conditional behaviour
- property outcomes -- a list showing all courses of action resulting from one or more conditions
-
- ------------------------------------------------------------------------------------------------------
-
- on new me,L
-
- -- (1) extract and check arguments:
-
- -- check for a parameter list:
- if ilk(L) <> #propList then return [#error:#noParamListSupplied, #msg:"navigationService:new"]
-
- -- a reference to the parent codebase is REQUIRED:
- main = L[#main]
- if (ilk(main) <> #instance) then return [#error:#noMainObjectSupplied, #msg:"navigationService:new"]
-
- --------------------
-
- -- initialise the list of visited flash frames - this gets used to inform the operation of the
- -- goBack method:
- flashFrameLog = []
-
- --------------------
-
- -- obtain known settings:
- dm = main.getDataManager()
- sL = dm.getData([#set:#settings])
-
- -- what suffix string do flashMenu framelabels have?
- menuSuffix = sL[#flashMenu][#frameLabelSuffix]
-
- --------------------
-
- -- pass back my address:
- return me
-
- ----------------------------------------------------------------------------------------------------
-
- on goBack me
-
- -- are there any previously visited locations in the current session? We need at least two entries
- -- in the frame log, because the final one is the CURRENT location, while the PENULTIMATE one is
- -- the one we want to return to...
-
- -- check eligibility:
- c = count(flashFrameLog)
- if c < 2 then return [#error:#cantGoBackAnyFurther, #message:"navigationService:goBack"]
-
- --------------------
-
- -- get the previous logged location:
- L = flashFrameLog[c-1]
-
- -- delete the latest ( = current) logged location:
- deleteAt(flashFrameLog,c)
-
- -- add the flashMenu suffix (to avoid normal transitional animations):
- L[#suffix] = menuSuffix
-
- -- flag backwards movement as a parameter:
- L[#direction] = #backwards
-
- -- go to the previous location:
- me.goFlashFrame(L)
-
- ----------------------------------------------------------------------------------------------------
-
- on doQuit me
-
- -- (this implicitly invokes the application call: "stopMovie:clearMain"):
- quit
-
- ----------------------------------------------------------------------------------------------------
-
- on goFlashFrame me,L
-
- -- basic flash movie navigation:
-
- --------------------
-
- -- check for parameter listing:
- if ilk(L) <> #propList then return [#error:#e1033]
-
- -- extract flash sprite number:
- s = L[#flashSprite]
- if voidP(s) then return [#error:#e1034]
-
- -- must be an integer!
- if not integerP(s) then return [#error:#e1037]
-
- -- must be a positive number!
- if s < 1 then return [#error:#e1038]
-
- -- check flash sprite exists:
- if (sprite(s).member).type <> #flash then return [#error:#e1028]
-
- -- check flash frameLabel provided:
- f = L[#frameLabel]
- if voidP(f) then return [#error:#e1035]
-
- -- does this frameLabel exist?
- if not findLabel(sprite s,f) then return [#error:#e1036, #msg:"frameLabel =" && f]
-
- --------------------
-
- -- use suffix if one is supplied:
- ss = L[#suffix]
- if stringP(ss) then f = f & ss
-
- -- branch to and play from the frame label f WITHIN the flash sprite s:
- goToFrame(sprite s,f)
- play sprite s
-
- --------------------
-
- -- log current location (except when moving backwards):
- d = L[#direction]
- if (d <> #backwards) then add flashFrameLog,L
-
- -- clear the cursor:
- sm = main.getServiceManager()
- cs = sm.getService(#cursorService)
- cs.clearCursor()
-
- ----------------------------------------------------------------------------------------------------