XFIRd 39VMpami\ :*YEK t~muhT}DEMXmuhTDEMXmuhT muhT muhT DEMX muhT DEMX muhT DEMX muhT DEMXmuhTDEMXmuhTDEMXmuhTmuhTDEMXTXTSTXTSmuhTDEMXmuhTDEMX"muhT"DEMX#TXTS$muhT$DEMX%TXTS)muhT)DEMX*TXTS-muhT-DEMX.TXTS0TXTS1muhT2muhT3muhT4muhT5muhT6muhT6DEMX7muhT7DEMX8muhT8DEMX;muhT;DEMX=TXTS?TXTS@TXTScDmuhTDDEMX_TXTSemuhTeDEMXymuhTyDEMX|muhTH|DEMXVmuhTUDEMXXmuhTRDEMXTXTSKmuhTJDEMXOmuhTNDEMXmuhTDEMXumuhT DEMXimuhThDEMXmuhTLDEMX/TXTS0muhT0DEMX1TXTSe6muhTd6DEMX7muhT[7DEMXYmuhTYDEMXmmuhTmDEMXpmuhTpDEMXrmuhTrDEMXtmuhTtDEMXwmuhTwDEMXzmuhTzDEMXQ|muhT|DEMXmuhTMDEMXWmuhTDEMX*SACMfniCGFCRDKpamFJXtcLNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREVNSREV lccFCRDTT::<`VfniCW79C:\java\comp190\190-5\Casts*SAC<  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF|-hyx1_/0]Y!e\I 5796lmn8pq]r_stuvwxyz{G|}~k^tSACw /////37E IntroText>п mText,a>?>rJeremy Parkertext,a3TEXd2??NoTextureStSAC .3GWWWWW[_c HomeStart&>п mText, >z>] text 3TEXd2??NoTextureitSAC %****>>>>>>RRRRRRVZhon exitFrame me go to the frame endloop5,>>rJeremy ParkertSAC@$ $2 #z###############-- Fade In_Out -- Fades a sprite between two fade values once, multiple times, or indefinitely. -- v1 - 9 October 1998 by Darrel Plant -- -- Modified 10 January, 2000 by Tom Higgins: added the isOKToAttach -- and resolve event handlers, removed redundant error checking. on getBehaviorDescription me return \ "FADE IN/OUT" & RETURN & RETURN & \ "Gives the appearance of a sprite fading in or out. " & \ "Choose whether the sprite should first appear at maximum (faded in) or minimum (faded out) values, when the fading should start, the minimum and maximum fade values, the number of times it should fade, and how fast it should fade. " & \ "The fade can be activated automatically in the first frame, by a click on the sprite, or by sending the sprite an mFadeActivate message." & RETURN & RETURN & \ "PERMITTED MEMBER TYPES:" & RETURN & \ "animated GIF, bitmap, Flash, text, vector shape" & RETURN & RETURN & \ "PARAMETERS:" & RETURN & \ "* Fade in or out?" & RETURN & \ "* Maximum fade value" & RETURN & \ "* Minimum fade value" & RETURN & \ "* Fade activation (automatic, click, or message)" & RETURN & \ "* Number of fade cycles" & RETURN & \ "* Time period for fade in seconds" & RETURN & RETURN & \ "Set the number of fade cycles to -1 if you want an endless loop, or to 0 if the fade should happen only once." end getBehaviorDescription on getBehaviorTooltip me return \ "Fades a sprite between two fade values once, multiple times, or indefinitely. " & \ "The fade can be initiated automatically, by mouse click, or via a message to the sprite." end getBehaviorTooltip -- PROPERTIES -- property pSprite -- sprite object reference property pStart -- time last fade started property pActive -- activity flag for fade action property pCompleteCycles -- counter for fade cycles property pFadeDiff -- difference between maximum and minimum fade values -- author-defined parameters property pFaded -- does sprite begin fade in or out property pAuto -- when does fade begin property pFadeMax -- maximum fade value property pFadeMin -- minimum fade value property pCycles -- number of times to repeat fade property pPeriodBase -- author-defined fade period property pPeriod -- fade period in milliseconds -- EVENT HANDLERS -- on beginSprite me pFaded = resolve(pFaded) pAuto = resolve(pAuto) mInitialize me end beginSprite on resolve (prop) case prop of pFaded: choicesList = ["In", "Out"] lookup = [#in, #out] pAuto: choicesList = ["Automatic", "Click", "Message"] lookup = [#automatic, #click, #message] end case return lookup[findPos(choicesList, prop)] end resolve on prepareFrame me mUpdate me end prepareFrame on mouseUp me if pAuto = #click then mActivate me end mouseUp -- CUSTOM HANDLERS -- on mInitialize me -- determine sprite reference pSprite = sprite (me.spriteNum) -- flag for fade action pActive = #off -- initialize cycle counter pCompleteCycles = 0.5 -- convert user-set period to milliseconds pPeriod = pPeriodBase * 1000 -- ensure that maximum is greater than minimum if pFadeMax < pFadeMin then -- if max is less than min, swap values vMax = pFadeMax pFadeMax = pFadeMin pFadeMin = vMax end if -- determine difference between max and min pFadeDiff = pFadeMax - pFadeMin -- if first fade action is 'in', sprite needs to be faded 'out' first if pFaded = #in then pSprite.blend = pFadeMin else pSprite.blend = pFadeMax end if -- activate sprite if automatic activation is set if pAuto = #automatic then mActivate me end mInitialize on mUpdate me -- only update sprite if active flag is set if pActive <> #off then -- derive current value of millisecond timer vMillis = the milliseconds -- determine milliseconds elapsed since fade start vElapsed = vMillis - pStart -- compare elapsed time to fade period if vElapsed >= pPeriod then -- time has elapsed, fade should finish -- set sprite to value for end of fade action case pActive of #in: pSprite.blend = pFadeMax #out: pSprite.blend = pFadeMin end case -- deactivate activity flag pActive = #off -- increment cycle counter and reverse if necessary mCheckCycle me else -- scale difference between fade values to elapsed time vFadeDiff = integer (pFadeDiff * vElapsed / pPeriod) -- depending on current value of activity flag, set blend -- to starting point of flag action plus or minus scaled -- difference between fade values case pActive of #in: pSprite.blend = pFadeMin + vFadeDiff #out: pSprite.blend = pFadeMax - vFadeDiff end case end if end if end mUpdate on mActivate me -- if pFadeDiff (the difference between pFadeMax and pFadeMin) is 0 -- then fade is never activated if pFadeDiff then -- start fade actions -- test whether sprite should fade in or out as first action case pFaded of -- intiate fade in action #in: mFadeIn me -- initiate fade out action #out: mFadeOut me end case end if end mActivate on mCheckCycle me -- used to determine whether to initiate another fade action -- this is checked after each fade action -- set continuation flag vContinue = FALSE -- check cycle setting case pCycles of -- if value is -1, sprite will cycle forever, set flag to TRUE -1: vContinue = TRUE -- if value is 0, sprite should stop after first fade action 0: vContinue = FALSE otherwise -- any other value will cycle 1 to 10 times -- each fade action increments counter by 0.5 pCompleteCycles = pCompleteCycles + 0.5 -- compare counter to total number of cycles if integer (pCompleteCycles) <= pCycles then -- if counter is less than numberof cycles, continue fading vContinue = TRUE end if end case -- if continuation flag has been set, then determine which way to fade if vContinue then -- compare current blend value to maximum fade if pSprite.blend = pFadeMax then -- if they are equal, fade sprite out mFadeOut me else -- otherwise, fade sprite in mFadeIn me end if end if end mCheckCycle on mFadeIn me mFade me, #in end mFadeIn on mFadeOut me, vTarget mFade me, #out end mFadeOut on mFade me, vInOut -- general-purpose fade handler -- set activity flag pActive = vInOut -- start fade timer pStart = the milliseconds end mFade --PUBLIC METHOD --use this method to send a message to the sprite and initiate --the Fade In or Out. --Example: --sendSprite(1, #mFadeActivate) on mFadeActivate me -- message sent to activate sprite if not auto or by click if pAuto = #message then mActivate me end mFadeActivate -- AUTHOR-DEFINED PARAMETERS on isOKToAttach (me, aSpriteType, aSpriteNum) case aSpriteType of #graphic: return getPos([#animgif, #bitmap, #flash, #text, #vectorShape], \ sprite(aSpriteNum).member.type) <> 0 #script: return FALSE end case end isOKToAttach on getPropertyDescriptionList me vPDList = [:] setaProp vPDList, #pFaded, [#comment: "Fade in or out?", #format: #string, \ #default: "In", #range: ["In", "Out"]] setaProp vPDList, #pFadeMax, [#comment: "Maximum Fade Value", #format: #integer, \ #default: 100, #range: [#min: 0, #max: 100]] setaProp vPDList, #pFadeMin, [#comment: "Minimum Fade Value", #format: #integer, \ #default: 0, #range: [#min: 0, #max: 100]] setaProp vPDList, #pAuto, [#comment: "Start automatically, when clicked, or by message?", #format: #string, \ #default: "Automatic", \ #range: ["Automatic", "Click", "Message"]] setaProp vPDList, #pCycles, [#comment: "Fade cycles (0 = one fade only, -1 = repeat forever)", #format: #integer, \ #default: 0, #range: [#min: -1, #max:10]] setaProp vPDList, #pPeriodBase, [#comment: "Time period for fade (seconds)", \ #format: #float, #default: 2.0, #range: [#min: .25, #max: 15.0]] return vPDList end getPropertyDescriptionList Fade In Out[#pFaded: [#comment: "Fade in or out?", #format: #string, #default: "In", #range: ["In", "Out"]], #pFadeMax: [#comment: "Maximum Fade Value", #format: #integer, #default: 100, #range: [#min: 0, #max: 100]], #pFadeMin: [#comment: "Minimum Fade Value", #format: #integer, #default: 0, #range: [#min: 0, #max: 100]], #pAuto: [#comment: "Start automatically, when clicked, or by message?", #format: #string, #default: "Automatic", #range: ["Automatic", "Click", "Message"]], #pCycles: [#comment: "Fade cycles (0 = one fade only, -1 = repeat forever)", #format: #integer, #default: 0, #range: [#min: -1, #max: 10]], #pPeriodBase: [#comment: "Time period for fade (seconds)", #format: #float, #default: 2.0000, #range: [#min: 0.2500, #max: 15.0000]]]iYiY,>rJeremy ParkertSAC %++++??????SSSSSSW[ion exitFrame me go to the frame endLoop25,>9>rJeremy ParkeretSAC Target>>rJeremy Parker7tSACx  0000048F TargetText>п mText2>)>rJeremy Parkertext23TEXd2??NoTexturetSACo'''''+/=s>п mText22>>rJeremy Parkertext223TEXd2??NoTexturetSACo'''''+/=f>п mText22>>rJeremy Parkertext223TEXd2??NoTexturetSACo'''''+/=j>п mText22>>rJeremy Parkertext223TEXd2??NoTexturetSACo'''''+/=k>п mText22>>rJeremy Parkertext223TEXd2??NoTexturetSACo'''''+/=l>п mText22>>rJeremy Parkertext223TEXd2??NoTextureitSAC %....BBBBBBVVVVVVZ^lon exitFrame me go to the frame endhomeloopmF!!,>>rJeremy ParkertSAC DJJJJ^^^^^^rrrrrrvzon exitFrame me voiceSet(1) voiceSpeak("s") delay 2 * 60 endsexit&//,>c>rJeremy ParkertSAC DJJJJ^^^^^^rrrrrrvzon exitFrame me voiceSet(1) voiceSpeak("d") delay 2 * 60 enddexitu=//,>>rJeremy ParkertSAC DJJJJ^^^^^^rrrrrrvzon exitFrame me voiceSet(1) voiceSpeak("f") delay 2 * 60 endfexit&//,>>rJeremy ParkertSAC DJJJJ^^^^^^rrrrrrvzon exitFrame me voiceSet(1) voiceSpeak("j") delay 2 * 60 endjexit&//,>>rJeremy ParkertSAC  DJJJJ^^^^^^rrrrrrvzon exitFrame me voiceSet(1) voiceSpeak("k") delay 2 * 60 endkexit&//,>>rJeremy ParkertSAC  BHHHH\\\\\\pppppptxon exitFrame me voiceSet(1) voiceSpeak("l") delay 2 * 60 endlexitu=,>>rJeremy ParkertSAC Target2>>rJeremy ParkeretSACy !!1111159G TargetTExt2>п mText2d>>rJeremy Parkertext2d3TEXd2??NoTextureutSAC (7777KK____ssssssw{on mouseUp go to frame "HomeStart" endtoHomeIntroBut&2i,>>rJeremy Parker dutSAC   '''';;OOOOccccccgkyon mouseUp go to frame "a" endTryBut&2i,>I>rJeremy Parker dtSACr*****.2@sTry>п mText;>Q>rJeremy Parkertext;3TEXd2??NoTexturetSAC   Yccccwwwwwwon exitFrame me voiceSet(2) voiceSpeak("the left ring finger is placed on the s") end sInstruct0VSS,>R#> 2Jeremy ParkeritSAC ,,,,,,048on exitFrame me go to the frame on keyDown currKey = the key currKeyNum = currKey.charToNum voiceSet(2) if keyPressed("s") then voiceSpeak("correct") go to the frame + 1 else pronounceKey currKeyNum end if end keyDown endsexittry0V,>S>c tSACr*****.2@dTry>п mTexty>T+>rJeremy Parkertexty3TEXd2??NoTexturetSAC //////37;on exitFrame me go to the frame on keyDown currKey = the key currKeyNum = currKey.charToNum voiceSet(3) if keyPressed("d") then voiceSpeak("that's right") go to the frame + 1 else pronounceKey currKeyNum end if end keyDown enddtryexit0V,>T>e itSAC  Zaaaauuuuuuon exitFrame me voiceSet(1) voiceSpeak("the left index finger is placed on the f") endfenter TT,>UC> &Jeremy ParkeritSAC ------159on exitFrame me go to the frame on keyDown currKey = the key currKeyNum = currKey.charToNum voiceSet(1) if keyPressed("f") then voiceSpeak("excellent") go to the frame + 1 else pronounceKey currKeyNum end if end keyDown endftryexit0V,>V >d tSACr*****.2@fTry>п mTextn>U>rJeremy Parkertextn3TEXd2??NoTexturetSAC  %%%%99MMMMaaaaaaeiwon mouseUp go to frame "j" endfButu=C,>U>rJeremy ParkerdtSACr*****.2@jTry>п mText{>V>rJeremy Parkertext{3TEXd2??NoTexturetSAC  %%%%99MMMMaaaaaaeiwon mouseUp go to frame "k" endjButu=C,>W>rJeremy Parker ditSAC  [bbbbvvvvvvon exitFrame me voiceSet(2) voiceSpeak("the right index finger is placed on the j") endjenter UU,>W> Jeremy ParkertSAC ------159on exitFrame me go to the frame on keyDown currKey = the key currKeyNum = currKey.charToNum voiceSet(2) if keyPressed("j") then voiceSpeak("well done") go to the frame + 1 else pronounceKey currKeyNum end if end keyDown endjtryexit0V,>W;>d itSAC  \ccccwwwwwwon exitFrame me voiceSet(3) voiceSpeak("the right middle finger is placed on the k") endkenter VV,>W> Jeremy ParkertSACr*****.2@kTry>п mText]>W>rJeremy Parkertext]3TEXd2??NoTexturetSAC  %%%%99MMMMaaaaaaeiwon mouseUp go to frame "l" endkButu=C,>W>rJeremy Parker ditSAC ))))))-15on exitFrame me go to the frame on keyDown currKey = the key currKeyNum = currKey.charToNum voiceSet(3) if keyPressed("k") then voiceSpeak("bravo") go to the frame + 1 else pronounceKey currKeyNum end if end keyDown endktryexit0V,>W>d itSAC  Zaaaauuuuuuon exitFrame me voiceSet(1) voiceSpeak("the right ring finger is placed on the l") endlenter TT,>Xg> Jeremy ParkertSACr*****.2@lTry>п mText?>X>rJeremy Parkertext?3TEXd2??NoTexturetSAC  %%%%99MMMMaaaaaaeiwon mouseUp go to frame ";" endlButu=C,>X>rJeremy Parker ditSAC ......26:on exitFrame me go to the frame on keyDown currKey = the key currKeyNum = currKey.charToNum voiceSet(1) if keyPressed("l") then voiceSpeak("very good") go to the frame + 1 else pronounceKey currKeyNum end if end keyDown end ltry exit0V,>X>d tSAC)2222FFZZZZnnnnnnrvon mouseUp go to frame "IntroStart" endBeginButDA%%%2i,>/>rJeremy ParkertSACj \La--****************************************************************************** -- SUMMARY --****************************************************************************** --Description: -- This is the main control behavior for the Accessibility behavior -- library. It acts as a focus ring when the user tabs between items, -- hilighting the currently selected 'Item'. Also, it allows the Accessibility -- behaviors to interact with one another. On its own this Target behavior -- provides no control. -- -- The focus ring provided by this behavior may be used with or with speech -- abilities. As such it provides a navigational aid. Speech behaviors may be -- applied as an additional aid to the user. -- -- There are three subsets of Accessibility behaviors. First are the controlling -- behaviors. These are mandatory and consist of the "Target" and "Keyboard" -- Controller". The Target acts as the main message portal for all Accessibility -- behaviors. It also acts as a focus ring to the user. If no focus ring is -- needed simple set the focus ring sprite's ink blend to zero. -- -- The second mandatory control behavior is the "Keyboard Controller". This is -- applied to an editable text sprite. That sprite is used to watch the user's -- keystrokes and act upon the appropriate shortcuts for tabbing, etc. These two -- behaviors must be implemented before any other Accessibility behaviors can be -- used. -- ------------------------------------------------------------------------------ -- * CONTROL: The following lists the controller behaviors: -- -- 1) "Target": This behavior. There need be only one target behavior for all -- of the other behaviors to interact. -- -- 2) "Keyboard Controller": This behavior manages the navigation -- keyboard events such as tab, tab back, go to top, etc. There must be -- one, and only one, of this behavior assigned to a text member that should -- be placed off stage. There need be only one keyboard controller behavior -- for all of the other behaviors to interact. -- -- The second subset of Accessibility behaviors allow navigation and tabbing to -- be accomplishes. These behaviors allow you to select which sprites will be -- items that are tabbed to. Also, with these behaviors you can can set the -- tabbing order for these items. Unlike speech products which use a predetermined -- algorithm to determine tabbing order for the end user, Director lets the -- tabbing order be set by the author. -- ------------------------------------------------------------------------------ -- * TABBING: The following lists the navigation behaviors. In order to use -- these, the controller behaviors must first be applied. -- -- 1) "Item": Each sprite that is to be tabbed to must have this behavior -- assigned to it. The exception are editable text sprites which are -- described below. -- -- 2) "Text Edit Item": Each editable text sprite that is to be tabbed to and -- edited by the user must have this behavior assigned to it. -- -- 3) "Group Order": This is what allows the tab order of sprites to be set. -- ------------------------------------------------------------------------------ -- * SPEECH: If Speech ability is desired, the following lists the subset of -- Speech behaviors. In order to use these, the control behaviors and -- tabbing behaviors must first be applied as described. -- -- 1) "Speak": This allows a string to be spoken when a sprite is tabbed to. -- -- 2) "Speak Member Text": This allows the text of a member to be spoken when -- a sprite is tabbed to. -- -- 3) "Speak Enable/Disable": Allows the speaking to be turned on or off. -- ------------------------------------------------------------------------------ -- * CAPTIONING: If closed captioing ability is desired, the following lists -- the subset of captioning behaviors. In order to use these, the control, -- tabbing and speech behaviors must first be applied as described. -- 1) "Synch Caption": When dropped on a sprite which has a speak behavior -- attached, this behavior specifies at which word, specific text -- chunks are sent to the "Captioning" text sprite. -- -- 2) "Captioning": Apply this to a text sprite so that sprites which speak -- can have their spoken text displayed in this sprite. -- -- --Usage: -- Drop this Accessibility behavior first. Drop it onto any sprite. Assign the -- behavior a group name in the dialog box that will pop up when dropped onto -- the sprite. That name will be used by the other Accessibility behaviors -- that are to be allowed interaction. For example, if you drop this Target -- behavior and give it the group name of "Accessibility_1", then other -- controls that are to interect should also be assigned to the group -- "Accessibility_1". -- -- Besides the group name, this behavior only has one other parameter. That -- parameter allows the enabling or disabling of the intial speak state. -- -- Place an editable text sprite off stage and apply the "Keyboard Controller" -- behavior to it to complete the controls. -- --History: -- 06 June 2002. Kraig Mentor. Initial File. -- -- -- --****************************************************************************** -- AUTHOR DEFINED PROPERTIES --****************************************************************************** property pGroupName -------------- String: The name of the group which will -- perform the action. property pAudioOffString ---------- String. The text to speak when the user -- enables speech. property pAudioOnString ----------- String. The text to speak when the user -- disabled speech. property pDynamicLocZ ------------- Boolean. When true, the focus ring will -- adjust its locZ to match the sprites in the -- current group. When false, the focus ring's -- locZ remains fixed. -- -- -- --****************************************************************************** -- GENERAL PROPERTIES --****************************************************************************** property pAlert ------------------- Property List. Tracks the error messages that -- have been given to the user. property pCaptioningEnabled ------- Boolean. True when the caption sprite is to -- be visible. property pControls ---------------- Property List. When a control registers with -- this behavior the controls information is -- kept here. property pCurrIndex --------------- Integer. Equal to the currently active group. property pDataList ---------------- Property List. Used for intersprite -- messaging. property pGroupReady -------------- Boolean. True when the accessibility group -- order behaviors are ready. property pInitialized ------------ Boolean. True once the initialization handler -- has run succesfully. property pMember ------------------ Member. The member of this sprite. property pOrigLocZ ---------------- Integer. The original locZ of this sprite. property pQueuedTriggeredEvents -- Property list. Contains a queue of handlers -- to be executed at the next enterFrame event. property pSpeakEnabled ------------ Boolean. True when speech is enabled. property pSprite ------------------ Sprite. This sprite. property pSpritesInCurrGroup ------ Linear list. The sprites that comprise the -- current group are listed here. property pStateOK ----------------- Boolean. True when the member's current -- state is stable. -- -- property pFirstGroupDrawn -- --****************************************************************************** -- SPRITE HANDLERS --****************************************************************************** --PURPOSE: Initialize behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on beginSprite(me) pSprite = sprite(me.spriteNum) pMember = pSprite.member pStateOK = me.isStateOK(pMember, pSprite) pAlert = [:] pAlert[#noKeyBoard] = 0 pOrigLocZ = pSprite.locZ if pStateOK then pInitialized = me.initialize() else pInitialized = FALSE end if end ------------------------------------------------------------------------------ --PURPOSE: General clean up. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------ on endSprite(me) pQueuedTriggeredEvents = void pSprite.locZ = pOrigLocZ voiceStop() end endSprite --****************************************************************************** -- EVENT HANDLERS --****************************************************************************** --PURPOSE: Checks to see if a trigger event has been recieved. If so it executes -- the requested handler. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on enterFrame(me) if pStateOK then --The member state is OK. if pInitialized then --Initialization is complete. if pGroupReady then --The Group behaviors are all ready. if ( pCurrIndex > 0 ) then if pQueuedTriggeredEvents.count > 0 then --There are events to process. repeat with j = 1 to pQueuedTriggeredEvents.count tEvent = pQueuedTriggeredEvents.getPropAt(j) me.processEvent(tEvent, pQueuedTriggeredEvents[j]) if voidP( pQueuedTriggeredEvents ) then --Need to check for void here. The user could have sent the --playback head to another frame where this sprite does not --exits. So, this handler will continue to complete even though --pQueuedTriggeredEvents no longer exists. exit repeat end if end repeat pQueuedTriggeredEvents = [:] end if else me.initializeFirstIndex() end if else --(!pGroupReady) --Before allowing the Ring to be used, we need to make sure that the --ring groups are all ready to go. pGroupReady = me.checkReadyStates() end if else --(!pInitialized) pInitialized = me.initialize() end if else --(!pStateOK) ----The member state is not OK. pStateOK = me.isStateOK(pMember, pSprite) end if end enterFrame --****************************************************************************** -- CUSTOM HANDLERS --****************************************************************************** on calcGroupRect(me, aRectList) --Calculate the rect required to fit around all items in this group tLeft = 64000 tRight = -64000 tTop = 64000 tBottom = -64000 repeat with j in aRectList if j.left < tLeft then tLeft = j.left if j.right > tRight then tRight = j.right if j.top < tTop then tTop = j.top if j.bottom > tBottom then tBottom = j.bottom end repeat tRect = rect(tLeft - 5, tTop - 5, tRight + 5, tBottom + 5) return( tRect ) end calcGroupRect ------------------------------------------------------------------------------ --PURPOSE: To verify that the "Accessibility Order" behaviors have settled -- and are ready to be used. --ACCEPTS: 'me' as an instance of this script. --RETURNS: 'tReady' as a boolean. True if all group items are ready. ------------------------------------------------------------------------------ on checkReadyStates(me) tReady = TRUE repeat with j = 1 to pQueuedTriggeredEvents.count --Go ahead and process only the ReadyState events. These were sent --during the first few frames when this Target was checking the states --of the groups. Up until this handler returns TRUE all events other --than "ReadyState" are ignored. tEvent = pQueuedTriggeredEvents.getPropAt(j) if tEvent = "ReadyState" then me.processEvent(tEvent, pQueuedTriggeredEvents[j]) end if end repeat repeat with j = 1 to pControls.accessGroup.count if ( pControls.accessGroup[j].trigger.data.ready = FALSE ) then --A Group was found that is not yet ready. tReady = FALSE exit repeat end if end repeat if ( NOT( tReady )) then --All of the groups were not ready. Go ask them again to see if they are --now ready. me.getGroupsReady() end if return(tReady) end ------------------------------------------------------------------------------ --PURPOSE: Sends a query to the appropriate behaviors to determine whether or -- not they are ready to be interacted with. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. Effects pDataList. ------------------------------------------------------------------------------ on getGroupsReady(me) if pControls.accessGroup.count > 0 then repeat with j = 1 to pControls.accessGroup.count tDataList = me.getBlankDataList() tDataList.target.type = pControls.accessGroup[j].trigger.type tDataList.target.spriteNum = pControls.accessGroup[j].trigger.spriteNum tDataList.target.obj = pControls.accessGroup[j].trigger.obj tDataList.msg = "ReadyState" me.sendTargetEvent(tDataList.duplicate()) end repeat end if end on ------------------------------------------------------------------------------ --PURPOSE: Create a property list which acts as an interface with other -- behaviors. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: A reference to a property list. ------------------------------------------------------------------------------ on getBlankDataList(me) tDataList = [#msg:"", #group:pGroupName, \ #trigger:[#type:me.myType(), #obj: me, #spriteNum:me.spriteNum, #data:[:]],\ #target:[#type: void, #obj: void, #spriteNum:void, #data:[:]]] tDataList.trigger.data = me.getTriggerDataList() return( tDataList.duplicate() ) end getBlankDataList ------------------------------------------------------------------------------ on getTriggerDataList(me) tTriggerDataList = [:] return( tTriggerDataList.duplicate() ) end getTriggerDataList ------------------------------------------------------------------------------ --PURPOSE: This handler scours the scriptList of each sprite to determine if -- any of the behaviors attached to that sprite can interface with -- this behavior. Those that can are returned in a list. --ACCEPTS: 'me' as an instance of this script. -- 'aCurrentSpriteNum' as an integer. It is this sprite channel. -- 'aStartChannel' as an integer. Searching begins from this channel -- up. -- 'aStopChannel' as an integer. Searching end with this channel. -- 'aTypeList' as a linear list of symbols. These are the type of -- behaviors to be looked for. -- 'aSearchMethod' as a symbol. It is the criteria for acceptable -- matches. --RETURNS: 'tGroupList' as a property list in the form of: -- ['aGroupName': [#spriteNum: n], etc...] ------------------------------------------------------------------------------ on getGroupsFromScriptList(me, aCurrentSpriteNum, aStartChannel, aStopChannel,\ aTypeList, aSearchMethod) tGroupList = [:] --Check each channel for available action behavior information. repeat with whichSprite = aStartChannel to aStopChannel if sprite(whichSprite).member.type <> #empty then tScriptList = sprite(whichSprite).scriptList --Check the scriptList of each sprite for a behavior that can respond. repeat with tWhichList = 1 to tScriptList.count tTempScriptInfo = tScriptList[tWhichList] --> In the form of: -- [(member n of castLib m), '[#pgroupname: 'aGroupName', \ -- #pPropertyA: 'aValue']'] tScriptProperties = value(tTempScriptInfo[2]) --> In the form of: -- [#pgroupname: 'aGroupName', #pPropertyA: 500] --If there is a scriptList then continue... if listP(tScriptProperties) then --This is the member of the script being checked. tRespondingScriptMember = tTempScriptInfo[1] --A check for empty must be performed in case the cast member has --multiple instances attached to a single sprite and is then moved in --the cast. if tRespondingScriptMember.type <> #empty then case aSearchMethod of #is: if ( tRespondingScriptMember.script.handler( #isOfType )) then --Verify that the behavior script is of a type that can --interact with this behavior script. repeat with tType in aTypeList if ( tRespondingScriptMember.script.isOfType() = tType ) then tGroupList.addProp(tScriptProperties.pGroupName, [#spriteNum:whichSprite]) end if end repeat end if #respondsTo: --If the script is set up to properly interact with groups, it --will contain a handler whose name is 'respondsToType'. Check --to see if it is there. if tRespondingScriptMember.script.handler(#respondsToType) then --Verify that the behavior script is of a type that can --interact with this behavior script. repeat with tType in aTypeList if tRespondingScriptMember.script.respondsToType().getOne(tType) > 0 then tGroupList.addProp(tScriptProperties.pGroupName, [#spriteNum:whichSprite]) end if end repeat end if end case end if end if end repeat end if end repeat return(tGroupList) end getGroupsFromScriptList ------------------------------------------------------------------------------- on getScriptName(me) tScriptName = string(me.script) tName = EMPTY repeat with tWord = 2 to tScriptName.word.count tName = tName && tScriptName.word[tWord] end repeat tName = tName.char[3..(tName.char.count) - 2] return(tName) end getScriptName --------------------------------------------------------------------------- on getSpritesInCurrentGroup( me, aIndex, aSpriteList, aRectList ) --Locate the members of the index and update the target sprite to --the proper dimensions to fit around them all. repeat with j = 1 to pControls.accessGroup.count if ( aIndex = pControls.accessGroup[j].trigger.data.index) then aRectList.add(pControls.accessGroup[j].trigger.data.rect) aSpriteList.add(pControls.accessGroup[j].trigger.spriteNum) tFoundGroup = TRUE end if end repeat end getSpritesInCurrentGroup ------------------------------------------------------------------------------- --PURPOSE: Performs initial set up of the behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: True. ------------------------------------------------------------------------------- on initialize(me) pInitialized = FALSE ppCurrIndex = -1 pGroupReady = FALSE pFirstGroupDrawn = FALSE pCaptioningEnabled = TRUE pQueuedTriggeredEvents = [:] --Set up the controls so that other behaviors can register. pControls = [:] tTypeList = me.respondsToType() repeat with tControl in tTypeList pControls.addProp(tControl, []) end repeat pSpritesInCurrGroup = [] --pDataList is used to send messages back and forth between controls. pDataList = me.getBlankDataList() return(TRUE) end initialize ------------------------------------------------------------------------------- --PURPOSE: To set up the position of the focus ring the very first time. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. Affects 'pCurrIndex', and 'pAlert'. ------------------------------------------------------------------------------- on initializeFirstIndex(me) if ( pControls.accessKeyBoard.count > 0 ) then --Dont set the first index until the keyboard controller has --been registered. tRectList = [] pSpritesInCurrGroup = [] me.getSpritesInCurrentGroup( 1, pSpritesInCurrGroup, tRectList ) if ( pSpritesInCurrGroup.count > 0 ) then pCurrIndex = 1 pFirstGroupDrawn = TRUE else pCurrIndex = 0 pFirstGroupDrawn = FALSE end if else if NOT(pAlert.noKeyBoard) then me.putKeyBoardAlert(pGroupName) --Set the noTarget flag so that this message isn't given again. pAlert.noKeyBoard = 1 end if end if end initializeFirstIndex ------------------------------------------------------------------------------- --PURPOSE: To return the type of this behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Symbol. The type of this behavior. ------------------------------------------------------------------------------- on isOfType(me) return(me.myType()) end isOfType ------------------------------------------------------------------------------- --PURPOSE: Verifies that conditions are acceptable for implementation. --ACCEPTS: 'me' as an instance of this script. --RETURNS: True if the member has the minimal acceptable state. ------------------------------------------------------------------------------- on isStateOK(me, aMember, aSprite) return( TRUE ) end isStateOK ------------------------------------------------------------------------------- --PURPOSE: Indicates the type of this behavior. This is what allows it to -- interact with other appropraite behaviors that recognize this type. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: A symbol indicating this behavior's type. ------------------------------------------------------------------------------- on myType(me) return(#accessTarget) end myType ------------------------------------------------------------------------------- --PURPOSE: --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processCaptioningToggle( me, aDataList ) tOrigState = pCaptioningEnabled pCaptioningEnabled = me.setCaptioningState(NOT(tOrigState), aDataList) end processCaptioningToggle ------------------------------------------------------------------------------- --PURPOSE: Clear the caption text. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processClearCaption( me, aDataList ) if ( pControls.accesscaption.count > 0 ) then if ( pControls.accessTextSynch.count > 0 ) then tDataList = me.getBlankDataList() tDataList.trigger.data = pControls.accessTextSynch[1].trigger.data.duplicate() tDataList.trigger.data.text = EMPTY tDataList.target.obj = pControls.accessCaption[1].trigger.obj tDataList.target.spriteNum = pControls.accessCaption[1].trigger.spriteNum tDataList.msg = "updateCaption" me.sendTargetEvent(tDataList) end if end if end processClearCaption ------------------------------------------------------------------------------- --PURPOSE: Set the state of speech enabled/disabled. --ACCEPTS: 'me' as an instance of this script. -- 'aState' as a boolean. Enabled when TRUE. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processDisableSynch( me, aState ) repeat with j = 1 to pControls.accessTextSynch.count tDataList = me.getBlankDataList() tDataList.msg = "setEnableState" tDataList.target.type = #accessTextSynch tDatalist.target.spriteNum = pControls.accessTextSynch[j].trigger.spriteNum tDatalist.target.obj = pControls.accessTextSynch[j].trigger.obj tDatalist.trigger.data = [#state:aState] me.sendTargetEvent( tDataList ) end repeat end processDisableSynch ------------------------------------------------------------------------------- --PURPOSE: Calls proper handlers for event. --ACCEPTS: 'me' as an instance of this script. -- 'aEvent' as a symbol. -- 'aDataList' as a property list containing information about the event. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processEvent(me, aEvent, aDataList) case aEvent of "ClearCaption": me.processClearCaption(aDataList) "SpeakImmediate": me.processClearCaption(aDataList) if ( pSpeakEnabled ) then voiceSpeak(aDataList.trigger.data.text) "EnableSynch": me.processDisableSynch( 1 ) "DisableSynch": me.processDisableSynch( 0 ) "RequestSychText": me.processRequestSynchText(aDataList) "SynchText": me.processSynchText(aDataList) "ReadyState": me.processReadyState(aDataList) "Tab": me.processClearCaption(aDataList) me.processTab(aDataList) "TabBack": me.processClearCaption(aDataList) me.processTabBack(aDataList) "Return": me.processReturn(aDataList) "SetIndex": me.processClearCaption(aDataList) me.processSetIndex(aDataList) "Speech Toggle": me.processSpeechToggle(aDataList) "Speech On": voiceStop() pSpeakEnabled = me.setSpeakState(TRUE) voiceSpeak(aDataList.trigger.data.onstring) "Speech Off": voiceStop() pSpeakEnabled = me.setSpeakState(TRUE) voiceSpeak(aDataList.trigger.data.offstring) pSpeakEnabled = me.setSpeakState(FALSE) "Captioning Toggle": me.processCaptioningToggle(aDataList) "Captioning On": pCaptioningEnabled = me.setCaptioningState(TRUE, aDataList) "Captioning Off": pCaptioningEnabled = me.setCaptioningState(FALSE, aDataList) end case end processEvent ------------------------------------------------------------------------------- --PURPOSE: Verifies that the registered group items are ready. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. Affects 'pControls.accessGroup[n].ready' ------------------------------------------------------------------------------- on processReadyState( me, aDataList ) --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessGroup.count if pControls.accessGroup[j].trigger.spriteNum = aDataList.trigger.spriteNum then if pControls.accessGroup[j].trigger.obj = aDataList.trigger.obj then pControls.accessGroup[j].trigger.data.ready = aDataList.trigger.data.ready --If one is not ready then dont bother checking the remainder. exit repeat end if end if end repeat end processReadyState ------------------------------------------------------------------------------- --PURPOSE: --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processRequestSynchText( me, aDataList ) repeat with j = 1 to pControls.accessSpeak.count --Locate the #accessSpeak control that is in this group. if pSpritesInCurrGroup.getOne(aDataList.trigger.spriteNum) then --At this point, the data list contains the text that should be displayed in --the captioning text sprite. tDataList = me.getBlankDataList() tDataList.msg = "getTextChunk" --Send this message back to the sprite that sent it. tDataList.target.spriteNum = aDataList.trigger.spriteNum tDataList.target.obj = aDataList.trigger.obj tDataList.trigger.data = aDataList.trigger.data.duplicate() me.sendTargetEvent(tDataList) exit repeat end if end repeat end processRequestSynchText ------------------------------------------------------------------------------- --PURPOSE: When the user has pressed the return key, this handler routes a -- message back to the initiating sprite telling it to execute the -- Lingo that is assigned to that item behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processReturn( me, aDataList ) --The user has pressed the RETURN key while on a group item. tDataList = me.getBlankDataList() tDataList.target.obj = aDataList.trigger.obj tDataList.msg = "DoCommand" repeat with j in pSpritesInCurrGroup tDataList.target.spriteNum = j me.sendTargetEvent(tDataList) end repeat end processReturn ------------------------------------------------------------------------------- --PURPOSE: Sets the focus to a particular index. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. Affects 'pCurrIndex'. ------------------------------------------------------------------------------- on processSetIndex( me, aDataList ) --Set the current group index to a new value. tMaxCount = 0 tGroupList = [] tGroupList.sort() repeat with j = 1 to pControls.accessGroup.count --Gather up the group numbers. if NOT(tGroupList.getOne(pControls.accessGroup[j].trigger.data.index)) then tGroupList.add(pControls.accessGroup[j].trigger.data.index) end if end repeat tIndex = aDataList.trigger.data.setIndex if (tIndex >= 1) AND ( tIndex <= tGroupList.count) then pCurrIndex = tIndex else if ( tIndex > tGroupList.count) then pCurrIndex = tGroupList.getLast() else if ( tIndex < 1) then pCurrIndex = 1 end if me.setCurrIndex(pCurrIndex, aDataList) end processSetIndex ------------------------------------------------------------------------------- --PURPOSE: --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processSpeechToggle( me, aDataList ) voiceStop() tOrigState = pSpeakEnabled me.setSpeakState(TRUE) if (pSpeakEnabled) then voiceSpeak(aDataList.trigger.data.offstring) else voiceSpeak(aDataList.trigger.data.onstring) end if pSpeakEnabled = me.setSpeakState(NOT(tOrigState)) end processSpeechToggle ------------------------------------------------------------------------------- --PURPOSE: --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processSynchText( me, aDataList ) if ( pControls.accesscaption.count > 0 ) then tDataList = me.getBlankDataList() tDataList.trigger.data = aDataList.trigger.data.duplicate() tDataList.target.obj = pControls.accessCaption[1].trigger.obj tDataList.target.spriteNum = pControls.accessCaption[1].trigger.spriteNum tDataList.msg = "updateCaption" me.sendTargetEvent(tDataList) end if end processSynchText ------------------------------------------------------------------------------- --PURPOSE: Move the group item index ahead one. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. Affects 'pCurrIndex'. ------------------------------------------------------------------------------- on processTab( me, aDataList ) --Move the focus ring to the next location. If it is at the last location --loop around to the beginning and start over from position 1. tNextIndex = 0 repeat with j = 1 to pControls.accessGroup.count tNextIndex = MAX(tNextIndex, pControls.accessGroup[j].trigger.data.index) end repeat if ( pCurrIndex < tNextIndex ) then pCurrIndex = pCurrIndex + 1 else pCurrIndex = 1 end if me.setCurrIndex(pCurrIndex, aDataList) end processTab ------------------------------------------------------------------------------- --PURPOSE: Move the group item index back one. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. Affects 'pCurrIndex'. ------------------------------------------------------------------------------- on processTabBack( me, aDataList ) --Move the focus ring to the previous location. If it is at the first location --loop around to the last position. if ( pCurrIndex > 1 ) then pCurrIndex = pCurrIndex - 1 else pCurrIndex = pControls.accessGroup.count end if me.setCurrIndex(pCurrIndex, aDataList) end processTabBack ------------------------------------------------------------------------------- --PURPOSE: Alert the user that there is no "Accessibility Keyboard Controller" -- attached to any sprite. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on putKeyBoardAlert(me, aGroupName) tString1 = "The following behavior:" & RETURN tString2 = "Behavior:" && ":" && QUOTE & "Accessibility Keyboard Controller" & QUOTE & RETURN & RETURN tString3 = tString1 & tString2 tString4 = "Is required by..." & RETURN & RETURN tString5 = "Sprite" && ":" && me.spriteNum & RETURN tString6 = "Behavior:" && ":" && QUOTE & me.getScriptName() & QUOTE & RETURN tString7 = "Group" && ":" && aGroupName & RETURN tString8 =tString4 & tString5 & tString6 & tString7 alert(tString3 & tString8) end on ------------------------------------------------------------------------------- --PURPOSE: Register accessibility captioning behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerCaption(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj --Only one keyBoard controller is allowed. if pControls.accessCaption.count = 0 then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessCaption.add(aDataList) pCaptioningEnabled = TRUE return(1) else return(0) end if end registerCaption ------------------------------------------------------------------------------- --PURPOSE: To allow appropriate behaviors to register themselves with this -- target behavior. --ACCEPTS: aDataList as a property list. Its generic form is: -- -- [#msg:pTargetAction, #group:pGroupName, \ -- #trigger:[#type: #someType, #obj: , #spriteNum: n, #data:[:]],\ -- #target: [#type: #someType, #obj: , #spriteNum: j, #data:[:]]] -- --RETURNS: Boolean. True if successfully registered. False otherwise. ------------------------------------------------------------------------------- on registerControl(me, aDataList) tRegistered = 0 if pInitialized then if me.respondsToType().getOne(aDataList.trigger.type) > 0 then --This behavior is confirmed to be able to respond to the type of --event that was received. if pGroupName = aDataList.group then case aDataList.trigger.type of #accessGroup: tRegistered = me.registerGroup(aDataList) #accessKeyBoard: tRegistered = me.registerKeyBoard(aDataList) #accessEditText: tRegistered = me.registerEditText(aDataList) #accessItem: tRegistered = me.registerItem(aDataList) #accessSpeak: tRegistered = me.registerSpeak(aDataList) #accessSpeakEnable: tRegistered = me.registerSpeakEnable(aDataList) #accessTextSynch: tRegistered = me.registerTextSynch(aDataList) #accessCaption: tRegistered = me.registerCaption(aDataList) end case end if end if end if return(tRegistered) end registerControl ------------------------------------------------------------------------------- --PURPOSE: Convert a descriptive, localized string into an associated handler -- and prepare that handler for execution. -- --ACCEPTS: 'me' as an instance of this script. -- 'aDataList' as a property list. It has the form of: -- [#msg:pTargetAction, #group:pGroupName, \ -- #trigger:[#type: #someType, #obj: , #spriteNum: n, \ -- #data:[:]],\ -- #target: [#type: #someType, #obj: , #spriteNum: j, \ -- #data:[:]]] --RETURNS: Nothing ------------------------------------------------------------------------------- on registerControlEvent(me, aDataList) if me.respondsToType().getOne(aDataList.trigger.type) > 0 then --This behavior is confirmed to be able to respond to the type of --event that was received. -- --tHandler is the string that is checked in the processEvent handler. tHandler = aDataList.msg pQueuedTriggeredEvents.addProp(tHandler, aDataList) end if pass end registerControlEvent ------------------------------------------------------------------------------- --PURPOSE: Register accessibility editable text behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerEditText(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj -- tRegistrationData = void --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessEditText.count if pControls.accessEditText[j].trigger.spriteNum = tToBeRegisteredSpriteNum then if pControls.accessEditText[j].trigger.obj = tToBeRegisteredObj then tFound = TRUE exit repeat end if end if end repeat if NOT(tFound) then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessEditText.add(aDataList) return(1) else return(0) end if end registerEditText ------------------------------------------------------------------------------- --PURPOSE: Register accessibility order behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerGroup(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj -- tRegistrationData = void --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessGroup.count if pControls.accessGroup[j].trigger.spriteNum = tToBeRegisteredSpriteNum then if pControls.accessGroup[j].trigger.obj = tToBeRegisteredObj then tFound = TRUE exit repeat end if end if end repeat if NOT(tFound) then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessGroup.add(aDataList) return(1) else return(0) end if end registerGroup ------------------------------------------------------------------------------- --PURPOSE: Register accessibility keyboard controller behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerKeyBoard(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj --Only one keyBoard controller is allowed. if pControls.accessKeyBoard.count = 0 then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessKeyBoard.add(aDataList) return(1) else return(0) end if end registerKeyBoard ------------------------------------------------------------------------------- --PURPOSE: Register accessibility item behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerItem(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessItem.count if pControls.accessItem[j].trigger.spriteNum = tToBeRegisteredSpriteNum then if pControls.accessItem[j].trigger.obj = tToBeRegisteredObj then tFound = TRUE exit repeat end if end if end repeat if NOT(tFound) then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessItem.add(aDataList) return(1) else return(0) end if end registerItem ------------------------------------------------------------------------------- --PURPOSE: Register accessibility editable text behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerTextSynch(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessTextSynch.count if pControls.accessTextSynch[j].trigger.spriteNum = tToBeRegisteredSpriteNum then if pControls.accessTextSynch[j].trigger.obj = tToBeRegisteredObj then tFound = TRUE exit repeat end if end if end repeat if NOT(tFound) then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessTextSynch.add(aDataList) return(1) else return(0) end if end registerTextSynch ------------------------------------------------------------------------------- --PURPOSE: Register accessibility speak behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerSpeak(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessSpeak.count if pControls.accessSpeak[j].trigger.spriteNum = tToBeRegisteredSpriteNum then if pControls.accessSpeak[j].trigger.obj = tToBeRegisteredObj then tFound = TRUE exit repeat end if end if end repeat if NOT(tFound) then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessSpeak.add(aDataList) return(1) else return(0) end if end registerSpeak ------------------------------------------------------------------------------- --PURPOSE: Register accessibility speak enable/disable behaviors. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. ------------------------------------------------------------------------------- on registerSpeakEnable(me, aDataList) tFound = FALSE tToBeRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeRegisteredObj = aDataList.trigger.obj --Make sure this control button is not already registered. repeat with j = 1 to pControls.accessSpeakEnable.count if pControls.accessSpeakEnable[j].trigger.spriteNum = tToBeRegisteredSpriteNum then if pControls.accessSpeakEnable[j].trigger.obj = tToBeRegisteredObj then tFound = TRUE exit repeat end if end if end repeat if NOT(tFound) then aDataList.target.type = me.myType() aDataList.target.obj = me aDataList.target.spriteNum = me.spriteNum pControls.accessSpeakEnable.add(aDataList) return(1) else return(0) end if end registerSpeakEnable ------------------------------------------------------------------------------- --PURPOSE: Provides a list of the type of events this behavior can respond to. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tList' as a linear list of symbols. ------------------------------------------------------------------------------- on respondsToType(me) tList = [#accessKeyBoard, #accessEditText, #accessTarget, \ #accessGroup, #accessItem, #accessSpeak, #accessSpeakEnable, \ #accessTextSynch, #accessCaption] return(tList.duplicate()) end respondsToType ------------------------------------------------------------------------------ --PURPOSE: Sends an event from this, the Target behavior, to one of its -- registered sprites. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------ on sendTargetEvent(me, aDataList) --Use to send an event to a specific target in the group. sendSprite(aDataList.target.spriteNum, #registerTargetEvent, aDataList) end sendTargetEvent ------------------------------------------------------------------------------ --PURPOSE: To hide/ unhid the captioning. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if new state is enabled. False otherwise. ------------------------------------------------------------------------------ on setCaptioningState(me, aState, aDataList) tState = 0 if ( pControls.accessCaption.count > 0 ) then tState = aState sprite(pControls.accessCaption[1].trigger.spriteNum).visible = tState if ( pSpeakEnabled ) then if (pCaptioningEnabled) then voiceSpeak(aDataList.trigger.data.offstring) else voiceSpeak(aDataList.trigger.data.onstring) end if end if end if return(tState) end setCaptioningState ------------------------------------------------------------------------------- --PURPOSE: To move the focus to a given index. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on setCurrIndex(me, aIndex, aDataList) ------------------------------------------------------------------------- if pFirstGroupDrawn then --The movie has been started and the very first tab item has already been --set up. ------------------------------------------------------------------------ if ( aIndex > 0 ) then --Just an error check. aIndex, should always be > 0. --------------------------------------------------------------------- if NOT( voidP( aDataList )) then --Make sure the list is a list. -------------------------------------------------------------------- if ( pControls.accessKeyBoard.count > 0 ) then --Make sure a kyb controller has been registered. tRectList = [] pSpritesInCurrGroup = [] tSpritesInCurrGroup = [] me.getSpritesInCurrentGroup( aIndex, tSpritesInCurrGroup, tRectList ) tVisibleSpriteList = [] repeat with j in tSpritesInCurrGroup if sprite(j).visible then pSpritesInCurrGroup.add(j) end if end repeat if pSpritesInCurrGroup.count > 0 then --Determine the rect around all sprites in this group order. tRect = me.calcGroupRect(tRectList) pSprite.rect = tRect if ( pDynamicLocZ ) then tLocZ = the maxInteger repeat with tSprite in pSpritesInCurrGroup --Set the focus ring's locZ to be the same as the lowest locZ --in the current group. tLocZ = MIN(tLocZ, sprite(tSprite).locZ) end repeat pSprite.locZ = tLocZ end if updatestage else me.processEvent(aDataList.msg, aDataList) end if me.setTextFocus() ------------------------------------------------------------------- if pSpeakEnabled then me.processDisableSynch( 1 ) repeat with j = 1 to pControls.accessSpeak.count if ( pSpritesInCurrGroup.getOne(pControls.accessSpeak[j].trigger.spriteNum )) then tDataList = me.getBlankDataList() tDataList.msg = "Speak" tDataList.target.spriteNum = pControls.accessSpeak[j].trigger.spriteNum tDataList.target.obj = pControls.accessSpeak[j].trigger.obj me.sendTargetEvent(tDataList) --There should only be one speak behavior in a group. Exit here as a safety --precaution. This essentially makes the first speak behavior that --registered the default. exit repeat end if end repeat updatestage end if --<\E>---------------------------------------------------------------- else if NOT(pAlert.noKeyBoard) then me.putKeyBoardAlert(pGroupName) --Set the noTarget flag so that this message isn't given again. pAlert.noKeyBoard = 1 end if end if --<\D>----------------------------------------------------------------- end if --<\C>------------------------------------------------------------------- end if --<\B>--------------------------------------------------------------------- end if --<\A>----------------------------------------------------------------------- end setCurrIndex ------------------------------------------------------------------------------- --PURPOSE: To move the focus to a given text sprite. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on setTextFocus(me) --Temporarily set the editable sprite to the keyboard controller sprite. the keyBoardFocusSprite = pControls.accessKeyBoard[1].trigger.spriteNum updatestage --Determine if there are any edit text behaviors in this group (tab order). repeat with j = 1 to pControls.accessEditText.count tDataList = me.getBlankDataList() tDataList.target.spriteNum = pControls.accessEditText[j].trigger.spriteNum tDataList.target.obj = pControls.accessEditText[j].trigger.obj tDataList.trigger.data = void if ( pSpritesInCurrGroup.getOne(pControls.accessEditText[j].trigger.spriteNum )) then the keyBoardFocusSprite = pControls.accessEditText[j].trigger.spriteNum updatestage tDataList.msg = "SetFocus" me.sendTargetEvent(tDataList) --There should only be one edit text in a group. Exit here as a safety --precaution. This essentially makes the first edit text behavior that --registered the default. exit repeat end if end repeat end setTextFocus ------------------------------------------------------------------------------ --PURPOSE: To enable/ disable the speaking voice. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if new state is enabled. False otherwise. ------------------------------------------------------------------------------ on setSpeakState(me, aState) tState = 0 if ( pControls.accessSpeakEnable.count > 0 ) then tState = aState end if return(tState) end setSpeakState ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility keyboard controller order from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterCaption(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessCaption.count if pControls.accessCaption[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessCaption[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessCaption.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterCaption ------------------------------------------------------------------------------ --PURPOSE: To remove a registered behavior from the Targets registry. -- --ACCEPTS: 'me' as an instance of this script. -- 'aDataList' as a property list. It has the form of: -- [#msg:pTargetAction, #group:pGroupName, \ -- #trigger:[#type: #someType, #obj: , #spriteNum: n, \ -- #data:[:]],\ -- #target: [#type: #someType, #obj: , #spriteNum: j, \ -- #data:[:]]] --RETURNS: True if succesful, false otherwise. ------------------------------------------------------------------------------ on unRegisterControl(me, aDataList) if pInitialized then if me.respondsToType().getOne(aDataList.trigger.type) > 0 then --This behavior is confirmed to be able to respond to the type of --event that was received. if pGroupName = aDataList.group then case aDataList.trigger.type of #accessGroup: tUnRegistered = me.unRegisterGroup(aDataList) #accessKeyBoard: tUnRegistered = me.unRegisterKeyBoard(aDataList) #accessEditText: tUnRegistered = me.unRegisterEditText(aDataList) #accessItem: tUnRegistered = me.unRegisterItem(aDataList) #accessSpeak: tUnRegistered = me.unRegisterSpeak(aDataList) #accessSpeakEnable: tUnRegistered = me.unRegisterSpeakEnable(aDataList) #accessTextSynch: tUnRegistered = me.unRegisterTextSynch(aDataList) end case end if end if end if return(tUnRegistered) end unRegisterControl ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility edit text item from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterEditText(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessEditText.count if pControls.accessEditText[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessEditText[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessEditText.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterEditText ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility group order from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterGroup(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessGroup.count if pControls.accessGroup[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessGroup[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessGroup.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterGroup ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility keyboard controller order from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterKeyBoard(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessKeyBoard.count if pControls.accessKeyBoard[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessKeyBoard[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessKeyBoard.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterKeyBoard ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility item from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterItem(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessItem.count if pControls.accessItem[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessItem[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessItem.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterItem ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility speak from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterSpeak(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessSpeak.count if pControls.accessSpeak[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessSpeak[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessSpeak.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterSpeak ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility speak from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterSpeakEnable(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessSpeakEnable.count if pControls.accessSpeakEnable[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessSpeakEnable[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessSpeakEnable.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterSpeakEnable ------------------------------------------------------------------------------ --PURPOSE: Remove accessibility captioning from registry. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on unRegisterTextSynch(me, aDataList) tToBeUnRegisteredSpriteNum = aDataList.trigger.spriteNum tToBeUnRegisteredObj = aDataList.trigger.obj tSuccess = 0 repeat with j = 1 to pControls.accessSpeakEnable.count if pControls.accessTextSynch[j].trigger.spriteNum = tToBeUnRegisteredSpriteNum then if pControls.accessTextSynch[j].trigger.obj = tToBeUnRegisteredObj then pControls.accessTextSynch.deleteAt(j) tSuccess = 1 exit repeat end if end if end repeat return(tSuccess) end unRegisterTextSynch --****************************************************************************** -- PREDEFINED HANDLERS --****************************************************************************** --PURPOSE: Provides a tooltip in the behavior library palette. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tString' as a string. ------------------------------------------------------------------------------ on getBehaviorToolTip(me) tString1 = "This is the main control behavior for 'Accessibility' behaviors. " & \ "It acts as a focus ring when the user tabs between items, hilighting the currently selected 'Item'. " & \ "Also, it allows the Accessibility behaviors to interact with one another." & RETURN & RETURN & \ "PERMITTED SPRITE TYPES:" & RETURN & \ "All except text." & RETURN & RETURN & \ "USAGE:" & RETURN & \ "1) Apply this 'Target' behavior first. " & \ "Do so onto the sprite that will act as the focus ring. " & \ "In the dialog box assign the behavior a group name and the initially enabled state. " & \ "The group name is used by other Accessibility behaviors to allow interaction. " & \ "" & RETURN & RETURN & \ "2) Apply the 'Keyboard Controller' behavior to an editable text sprite." & RETURN & RETURN & \ "3) Apply an 'Item' behavior onto each sprite that is to be tabbed to by the user. " & \ "" & RETURN & RETURN & \ "4) Apply a 'Text Edit Item' behavior onto each editable text sprite that is to be tabbed to and edited by the user." & RETURN & RETURN & \ "5) Apply a 'Group Order' behavior onto each 'Item' to specify the tab order." & RETURN & RETURN & \ "6) Apply 'Speak', 'Synch Caption' and 'Captioning' behaviors as needed." return(tString1) end getBehaviorToolTip ------------------------------------------------------------------------------ --PURPOSE: Provides a behavior description in the behavior inspector. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tString' as a string. ------------------------------------------------------------------------------ on getBehaviorDescription(me) tString1 = "ACCESSIBILITY TARGET" & RETURN & RETURN & \ "This is the main control behavior for 'Accessibility' behaviors. " & \ "It acts as a focus ring when the user tabs between items, hilighting the currently selected 'Item'. " & \ "Also, it allows the Accessibility behaviors to interact with one another. " & \ "There should be one and only one 'Target' focus ring for all of the Accessible behaviors to work together. " & \ "The 'Target' focus ring sprite should be placed off stage and should have no other accessibility behaviors attached to it." & RETURN & RETURN & \ "The following lists the other accessibility behaviors which are mandatory for minmal Accessibility implementation. " & \ "After the 'Target' focus ring behavior is applied, these mandatory behaviors should be applied to the other, appropriate sprites:" & RETURN & RETURN & \ "'Keyboard Controller', 'Item', 'Text Edit Item', 'Group Order'." & RETURN & RETURN & \ "The following lists the other Accessibility behaviors which are optional and may be applied to the other, appropriate sprites:" & RETURN & RETURN & \ "'Speak', 'Speak Member Text', 'Speak Enable/Disable', 'Synch Caption', 'Captioning'." & RETURN & RETURN & \ "USAGE:" & RETURN & \ "1) Apply this 'Target' behavior first. " & \ "Do so onto the sprite that will act as the focus ring. " & \ "In the dialog box assign the behavior a group name and the initially enabled state. " & \ "The group name is used by other Accessibility behaviors to allow interaction. " & \ "" & RETURN & RETURN & \ "2) Apply the ' Keyboard Controller' behavior to an editable text sprite." & RETURN & RETURN & \ "3) Apply an 'Item' behavior to each sprite that is to be navigated to by the user. " & \ "" & RETURN & RETURN & \ "4) Apply a 'Text Edit Item' behavior to each editable text sprite that is to be navigated to and edited by the user." & RETURN & RETURN & \ "5) Apply a 'Group Order' behavior to each 'Item' to specify the navigation order." & RETURN & RETURN & \ "6) Apply 'Speak', 'Synch Caption' and 'Captioning' behaviors as needed." & RETURN & RETURN & \ "" & RETURN & \ "DEPENDENCIES:" & RETURN & \ "- None." & RETURN & RETURN & \ "PARAMETERS:" & RETURN & \ "- This behavior's group name." & RETURN & \ "- Initial speech enabled or disabled state." & RETURN & RETURN & \ "PERMITTED SPRITE TYPES:" & RETURN & \ "- All except text." return(tString1) end getBehaviorDescription ------------------------------------------------------------------------------ --PURPOSE: Determines whether the behavior can be dropped onto a sprite in the -- score. --ACCEPTS: 'me' as a reference to a script member. -- 'aSpriteType' as a symbol. It indicates the type of sprite attempting -- to be dropped on to. -- 'aSpriteNum' as an integer. Indicates the channel of the sprite being -- dropped on to. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------ on isOKtoAttach(me, aSpriteType, aSpriteNum) tIsOK = FALSE case aSpriteType of #Graphic: if ( sprite(aSpriteNum).member.type = #text ) then tIsOK= FALSE else tIsOK = TRUE end if end case return(tIsOK) end isOKtoAttach ------------------------------------------------------------------------------ --PURPOSE: Allows the user a dialog box access to the behavior's properties. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tGPDList' as a property list containing author definable behavior -- properties ------------------------------------------------------------------------------ on getPropertyDescriptionList(me) tGPDList = [:] if the currentSpriteNum > 0 then tGroupList = me.getGroupsFromScriptList(the currentSpriteNum, 1, the lastChannel, [me.myType()], #is) tNumber = string(tGroupList.count + 1) tGPDList[#pGroupName] = \ [#comment:"Name of this Accessibility group?",\ #format: #string,\ #default: "Accessibility" && tnumber] tGPDList[#pSpeakEnabled] = \ [#comment:"Speech initially enabled?",\ #format: #boolean,\ #default: TRUE] tGPDList[#pDynamicLocZ] = \ [#comment:"Match channel depth?",\ #format: #boolean,\ #default: FALSE] end if return(tGPDList) end getPropertyDescriptionList --****************************************************************************** --****************************************************************************** --******************************************************************************Accessibility Target3F:\code\oz\Auth\External\Generic\libs\AccessibilityAccessibility Target.txt[:]x,:m>rJeremy ParkertSACai iSh)hKhhhhhhhhhhhhhhhhhh--****************************************************************************** -- SUMMARY --****************************************************************************** --Description: -- This behavior is used to intercept and act upon keyboard events. This allows -- an action to be initiated when the user presses return, tab, etc. -- -- This behavior requires an editable text sprite for application. The sprite -- should be placed off stage as it is not directly interacted with by the user. -- --Notes: -- For additional information on using Accessibility sprites, please read the -- comments section for the "Accessibility Target" behavior. -- --Usage: -- 1) If it has not already been applied to a sprite, apply the "Accessibility -- Target" behavior. -- -- 2) Apply this behavior to an editable text sprite. -- --History: -- 06 June 2002. Kraig Mentor. Initial File. -- -- -- --****************************************************************************** -- AUTHOR DEFINED PROPERTIES --****************************************************************************** property pGroupName ------ String: The name of the group which will perform the -- action. property pDoCommand ------ String. The user may instigate an action by pressing -- the return key when this sprite has focus. Enter the -- Lingo string, if any, to do when return is pressed. -- For example, " go frame "Tom" ". -- -- -- --****************************************************************************** -- GENERAL PROPERTIES --****************************************************************************** property pAlert ------------------ Property List. Tracks the error messages that -- have been given to the user. property pDataList --------------- Property List. Used for intersprite messaging. property pInitialized ------------ Boolean. True once the initialization handler -- has run. property pMember ----------------- Member. The member of this sprite. property pQueuedTriggeredEvents -- Property list. Contains a queue of handlers -- to be -- executed at the next enterFrame event. property pSprite ----------------- Sprite. This sprite. property pStateOK ---------------- Boolean. True when the member's initial state -- is stable. -- -- -- --****************************************************************************** -- SPRITE HANDLERS --****************************************************************************** --PURPOSE: Initialize behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. -------------------------------------------------------------------------------- on beginSprite(me) pSprite = sprite(me.spriteNum) pMember = pSprite.member pAlert = [:] pAlert[#noTarget] = 0 pStateOK = me.isStateOK(pMember, pSprite) if pStateOK then pInitialized = me.initialize() else pInitialized = FALSE end if end ------------------------------------------------------------------------------ --PURPOSE: General clean up. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------ on endSprite(me) pQueuedTriggeredEvents = void tGroupList = me.getGroupsFromScriptList( me.spriteNum, 1, the lastChannel, [#accessTarget], #is) if tGroupList.count > 0 then if ( pDataList.trigger.spriteNum = me.spriteNum ) then if ( pDataList.target.spriteNum <> me.spriteNum ) then thentUnregistered = me.unRegisterControl() end if end if end if end endSprite --****************************************************************************** -- EVENT HANDLERS --****************************************************************************** --PURPOSE: Checks to see if a trigger event has been recieved. If so it executes -- the requested handler. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on enterFrame(me) if pStateOK then --The member state is OK. if pInitialized then --Initialization is complete. repeat with j = 1 to pQueuedTriggeredEvents.count tEvent = pQueuedTriggeredEvents.getPropAt(j) me.processEvent(tEvent, pQueuedTriggeredEvents[j]) if voidP( pQueuedTriggeredEvents ) then --Need to check for void here. The user could have sent the playback --head to another frame where this sprite does not exits. So, this --handler will continue to complete even though pQueuedTriggeredEvents --is toast. exit repeat end if end repeat pQueuedTriggeredEvents = [:] else pInitialized = me.initialize() end if else pStateOK = me.isStateOK(pMember, pSprite) end if end enterFrame ------------------------------------------------------------------------------ --PURPOSE: To check for accessibility control keys. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------ on keyUp(me) case the keyCode of 48: tDataList = pDataList.duplicate() if NOT(the shiftDown) then --Tab ( Go to next item ) tDataList.msg = "Tab" else --Tab ( Go to previous item ) tDataList.msg = "TabBack" end if me.sendControlEvent(tDataList) 36: -- Return ( Initiate the user specified Lingo for the current item ) tDataList = pDataList.duplicate() tDataList.msg = "Return" me.sendControlEvent(tDataList) 116: -- Page Up ( Go to first item ) if (the controlDown) then tDataList = pDataList.duplicate() tDataList.msg = "SetIndex" tDataList.trigger.data.setIndex = 1 me.sendControlEvent(tDataList) end if 121: -- Page Down ( Go to last item ) if (the controlDown) then tDataList = pDataList.duplicate() tDataList.msg = "SetIndex" tDataList.trigger.data.setIndex = the maxInteger me.sendControlEvent(tDataList) end if end case pMember.text = EMPTY do pDoCommand end keyUp --****************************************************************************** -- CUSTOM HANDLERS --****************************************************************************** --PURPOSE: Create a property list which acts as an interface with other -- behaviors. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: A reference to a property list. ------------------------------------------------------------------------------ on getBlankDataList(me) tDataList = [#msg:"", #group:pGroupName, \ #trigger:[#type:me.myType(), #obj: me, #spriteNum:me.spriteNum, #data:[:]],\ #target:[#type: void, #obj: void, #spriteNum:void, #data:[:]]] tDataList.trigger.data = me.getTriggerDataList() return( tDataList.duplicate() ) end getBlankDataList ------------------------------------------------------------------------------ --PURPOSE: Create a property list which allows information to be passed back -- about the target behavior. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: A reference to a property list. ------------------------------------------------------------------------------ on getTriggerDataList(me) tTriggerDataList = [:] tTriggerDataList[#setIndex] = 0 return( tTriggerDataList.duplicate() ) end getTriggerDataList ------------------------------------------------------------------------------ --PURPOSE: This handler scours the scriptList of each sprite to determine if -- any of the behaviors attached to that sprite can interface with -- this behavior. Those that can are returned in a list. --ACCEPTS: 'me' as an instance of this script. -- 'aCurrentSpriteNum' as an integer. It is this sprite channel. -- 'aStartChannel' as an integer. Searching begins from this channel -- up. -- 'aStopChannel' as an integer. Searching end with this channel. -- 'aTypeList' as a linear list of symbols. These are the type of -- behaviors to be looked for. -- 'aSearchMethod' as a symbol. It is the criteria for acceptable -- matches. --RETURNS: 'tGroupList' as a property list in the form of: -- ['aGroupName': [#spriteNum: n], etc...] ------------------------------------------------------------------------------ on getGroupsFromScriptList(me, aCurrentSpriteNum, aStartChannel, aStopChannel, \ aTypeList, aSearchMethod) tGroupList = [:] --Check each channel for available action behavior information. repeat with whichSprite = aStartChannel to aStopChannel if sprite(whichSprite).member.type <> #empty then tScriptList = sprite(whichSprite).scriptList --Check the scriptList of each sprite for a behavior that can respond. repeat with tWhichList = 1 to tScriptList.count tTempScriptInfo = tScriptList[tWhichList] --> In the form of: -- [(member n of castLib m), '[#pgroupname: 'aGroupName', #pPropertyA: 'aValue']'] tScriptProperties = value(tTempScriptInfo[2]) --> In the form of: -- [#pgroupname: 'aGroupName', #pPropertyA: 500] --If there is a scriptList then continue... if listP(tScriptProperties) then --This is the member of the script being checked. tRespondingScriptMember = tTempScriptInfo[1] --A check for empty must be performed in case the cast member has --multiple instances attached to a single sprite and is then moved in --the cast. if tRespondingScriptMember.type <> #empty then case aSearchMethod of #is: if ( tRespondingScriptMember.script.handler( #isOfType )) then --Verify that the behavior script is of a type that can interact with this behavior script. repeat with tType in aTypeList if ( tRespondingScriptMember.script.isOfType() = tType ) then tGroupList.addProp(tScriptProperties.pGroupName, [#spriteNum:whichSprite]) end if end repeat end if #respondsTo: --If the script is set up to properly interact with groups, it will contain --a handler whose name is 'respondsToType'. Check to see if it is there. if tRespondingScriptMember.script.handler(#respondsToType) then --Verify that the behavior script is of a type that can interact with this behavior script. repeat with tType in aTypeList if tRespondingScriptMember.script.respondsToType().getOne(tType) > 0 then tGroupList.addProp(tScriptProperties.pGroupName, [#spriteNum:whichSprite]) end if end repeat end if end case end if end if end repeat end if end repeat return(tGroupList) end getGroupsFromScriptList ------------------------------------------------------------------------------ --PURPOSE: Create a linear list that is comprised of the property values -- of a property list. --ACCEPTS: 'aLlist' as a property list. --RETURNS: 'tList' as a linear list whose elements are ordered the same -- as the properties of the original list. ------------------------------------------------------------------------------ on getPropLabels(me, aList) tList = void if aList.ilk = #propList then tList = [] repeat with j = 1 to aList.count tList.add(aList.getPropAt(j)) end repeat end if return(tList) end getPropLabels ------------------------------------------------------------------------------ --PURPOSE: Determine the name of this script. --ACCEPTS: 'me' as an instance of this script. --RETURNS: 'tName' as a string. ------------------------------------------------------------------------------ on getScriptName(me) tScriptName = string(me.script) tName = EMPTY repeat with tWord = 2 to tScriptName.word.count tName = tName && tScriptName.word[tWord] end repeat tName = tName.char[3..(tName.char.count) - 2] return(tName) end getScriptName ------------------------------------------------------------------------------ --PURPOSE: Performs initialze set up of the sprite. --ACCEPTS: 'me' as an instance of this script. --RETURNS: True. --EFFECTS: 'pInitialized' gets set. ------------------------------------------------------------------------------ on initialize(me) pInitialized = FALSE tInitialized = FALSE tGroupList = me.getGroupsFromScriptList(me.spriteNum, 1, the lastChannel, [#accessTarget], #is) if tGroupList.count > 0 then pQueuedTriggeredEvents = [:] pDataList = me.getBlankDataList() pMember.text = EMPTY pMember.editable = TRUE if me.sendRegisterControl(tGroupList, pDataList) then tInitialized = TRUE end if end if return(tInitialized) end initialize ------------------------------------------------------------------------------- --PURPOSE: To return the type of this behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Symbol. The type of this behavior. ------------------------------------------------------------------------------- on isOfType(me) return(me.myType()) end isOfType ------------------------------------------------------------------------------- --PURPOSE: Verifies that conditions are acceptable for implementation. --ACCEPTS: 'me' as an instance of this script. --RETURNS: True if the member has the minimal acceptable state. ------------------------------------------------------------------------------- on isStateOK(me, aMember, aSprite) return( TRUE ) end isStateOK ------------------------------------------------------------------------------ --PURPOSE: Get the name of the required target behavior for this behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: String. The name of the required target behavior ------------------------------------------------------------------------------ on myTargetBehavior(me) return("Accessibility Target") end targetType ------------------------------------------------------------------------------- --PURPOSE: Indicates the type of this behavior. This is what allows it to -- interact with other appropraite behaviors that recognize this type. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: A symbol indicating this behavior's type. ------------------------------------------------------------------------------- on myType(me) return(#accessKeyBoard) end myType ------------------------------------------------------------------------------- --PURPOSE: Calls proper handlers for event. --ACCEPTS: 'me' as an instance of this script. -- 'aEvent' as a symbol. -- 'aDataList' as a property list containing information about the event. --RETURNS: Nothing. ------------------------------------------------------------------------------- on processEvent(me, aEvent, aDataList) nothing end processEvent ------------------------------------------------------------------------------- --PURPOSE: Alert the user that there is no appropriate target behavior attached -- to any sprite. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Nothing. ------------------------------------------------------------------------------- on putTargetAlert(me, aGroupName) tString1 = "The following behavior:" & RETURN tString2 = "Behavior:" && ":" && QUOTE &me.myTargetBehavior() & QUOTE & RETURN & RETURN tString3 = tString1 & tString2 tString4 = "Is required by..." & RETURN & RETURN tString5 = "Sprite" && ":" && me.spriteNum & RETURN tString6 = "Behavior:" && ":" && QUOTE & me.getScriptName() & QUOTE & RETURN tString7 = "Group" && ":" && aGroupName & RETURN tString8 =tString4 & tString5 & tString6 & tString7 alert(tString3 & tString8) end on ------------------------------------------------------------------------------- --PURPOSE: Convert a descriptive, localized string into an associated handler -- and prepare that handler for execution. -- --ACCEPTS: 'me' as an instance of this script. -- 'aDataList' as a property list. It has the form of: -- [#msg:pTargetAction, #group:pGroupName, \ -- #trigger:[#type: #someType, #obj: , #spriteNum: n, \ -- #data:[:]],\ -- #target: [#type: #someType, #obj: , #spriteNum: j, \ -- #data:[:]]] --RETURNS: Nothing ------------------------------------------------------------------------------- on registerTargetEvent(me, aDataList) if pInitialized then if me.respondsToType().getOne(aDataList.trigger.type) > 0 then --This behavior is confirmed to be able to respond to the type of --event that was received. tHandler = aDataList.msg pQueuedTriggeredEvents.addProp(tHandler, aDataList) end if end if pass end registerTargetEvent ------------------------------------------------------------------------------- --PURPOSE: Provides a list of the type of events this behavior can respond to. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tList' as a linear list of symbols. ------------------------------------------------------------------------------- on respondsToType(me) tList = [#accessGroup, #accessTarget] return(tList) end respondsToType ------------------------------------------------------------------------------- --PURPOSE: Registers this control with the appropriate target behavior. -- --ACCEPTS: 'me' as an instance of this script. -- 'aGroupList' as a property list in the form of: -- ["accessTarget1": [#spriteNum: 1],..] -- --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------- on sendControlEvent(me, aDataList) --Use to send an event to a specific target in the group. sendSprite(aDataList.target.spriteNum, #registerControlEvent, aDataList) end sendEvent ------------------------------------------------------------------------------- --PURPOSE: Registers this control with the appropriate target behavior. -- --ACCEPTS: 'me' as an instance of this script. -- 'aGroupList' as a property list in the form of: -- ["accessTarget1": [#spriteNum: 1],..] -- --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------- on sendRegisterControl(me, aGroupList, aDataList) tRegistered = 0 repeat with j = 1 to aGroupList.count() tGroup = aGroupList.getPropAt(j) if tGroup = pGroupName then tSpriteData = aGroupList[j] tRegistered = sendSprite(tSpriteData.spriteNum, #registerControl, aDataList) end if end repeat return(tRegistered) end sendRegisterControl ------------------------------------------------------------------------------- --PURPOSE: Unregisters this control with the appropriate target behavior. --ACCEPTS: 'me' as an instance of this script. --RETURNS: Boolean. True if successful. False otherwise. ------------------------------------------------------------------------------- on unRegisterControl(me) tUnregistered = 0 tUnregistered = sendSprite(pDataList.target.spriteNum, #unregisterControl, pDataList) return(tUnregistered) end unRegisterControl --****************************************************************************** -- PREDEFINED HANDLERS --****************************************************************************** --PURPOSE: Provides a tooltip in the behavior library palette. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tString' as a string. ------------------------------------------------------------------------------ on getBehaviorToolTip(me) tString1 = "This behavior is used to respond to the user's keyboard navigation." & RETURN & RETURN & \ "PERMITTED SPRITE TYPES:" & RETURN & \ "Editable Text." & RETURN & RETURN & \ "USAGE:" & RETURN & \ "1. " & \ "If not already done, on another sprite apply the 'Target' behavior to set up a focus ring" & RETURN & RETURN & \ "2. " & \ "Apply this behavior to an off stage, editable text sprite." return(tString1) end getBehaviorToolTip ------------------------------------------------------------------------------ --PURPOSE: Provides a behavior description in the behavior inspector. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'tString' as a string. ------------------------------------------------------------------------------ on getBehaviorDescription(me) tString1 = "ACCESSIBILITY KEYBOARD CONTROLLER" & RETURN & RETURN & \ "This behavior is used to respond to the user's keyboard navigation. " & \ "There should be one and only one 'Keyboard Controller' for all of the 'Accessible' behaviors to work together. " & \ "The 'Keyboard Controller' sprite should be placed off stage and should have no other accessibility behaviors attached to it. " & \ "The navigation shortcuts are:" & RETURN & RETURN & \ "- Tab : Go to the next 'Item'." & RETURN & \ "- Tab : Go to the previous 'Item'." & RETURN & \ "- Page Up : Go to the first 'Item'." & RETURN & \ "- Page Down : Go to the last 'Item'." & RETURN & \ "- Enter : Initiates the Lingo command specified in the sprite's 'Item' or 'Edit Text Item' behavior." & RETURN & RETURN & \ "" & RETURN & \ "USAGE:" & RETURN & \ "1. " & \ "If not already done, on another sprite apply the 'Target' behavior to set up a focus ring." & RETURN & RETURN & \ "2. " & \ "Apply this behavior to an off stage, editable text sprite." & RETURN & RETURN & \ "DEPENDENCIES:" & RETURN & \ "- Another sprite (not this one) must have the 'Target' behavior attached to it." & RETURN & RETURN & \ "PARAMETERS:" & RETURN & \ "- This behavior's group name." & RETURN & RETURN & \ "PERMITTED SPRITE TYPES:" & RETURN & \ "- Editable text." return(tString1) end getBehaviorDescription ------------------------------------------------------------------------------ --PURPOSE: Determines whether the behavior can be dropped onto a sprite in the -- score. --ACCEPTS: 'me' as a reference to a script member. -- 'aSpriteType' as a symbol. It indicates the type of sprite attempting -- to be dropped on to. -- 'aSpriteNum' as an integer. Indicates the channel of the sprite being -- dropped on to. --RETURNS: True if the behavior is allowed to be dropped on the sprite or score, -- false otherwise. ------------------------------------------------------------------------------ on isOKtoAttach(me, aSpriteType, aSpriteNum) tIsOK = FALSE if aSpriteType = #graphic then case sprite(aSpriteNum).member.type of #text: --Make sure the user isnt attempting to drop on a text sprite that has already been --assigned an Access Edit Text behavior. if (sprite(aSpriteNum).member.editable) then tGroupList = me.getGroupsFromScriptList( aSpriteNum, aSpriteNum, aSpriteNum, [#accessEditText], #is) -- ["FooGroupName": [#spriteNum: 1]] if ( tGroupList.count = 0) then --Make sure the appropriate Target behavior is already assigned. tGroupList = me.getGroupsFromScriptList( aSpriteNum, 1, the lastChannel, [#accessTarget], #is) if tGroupList.count > 0 then tIsOK = TRUE end if end if end if end case end if return(tIsOK) end isOKtoAttach ------------------------------------------------------------------------------ --PURPOSE: Allows the user a dialog box access to the behavior's properties. --ACCEPTS: 'me' as a reference to a script member. --RETURNS: 'TGPDList' as a property list containing author definable behavior -- properties ------------------------------------------------------------------------------ on getPropertyDescriptionList(me) tGPDList = [:] if ( the currentSpriteNum > 0 ) then --Make sure the appropriate Target behavior is already assigned. tGroupList = me.getGroupsFromScriptList(the currentSpriteNum, 1, the lastChannel, [#accessTarget], #is) if ( tGrouplist.count > 0 ) then tList = me.getPropLabels(tGroupList) tGPDList[#pGroupName] = \ [#comment: "Which Accessibility Group does this belong to?",\ #format: #string,\ #range:tList,\ #default: tList[1]] tGPDList[#pDoCommand] = \ [#comment:"Command to execute?",\ #format: #string,\ #default: "nothing"] end if end if return(tGPDlist) end getPropertyDescriptionList --****************************************************************************** --****************************************************************************** --******************************************************************************!Accessibility Keyboard Controller3F:\code\oz\Auth\External\Generic\libs\Accessibility%Accessibility Keyboard Controller.txt[:]po,:m>rJeremy Parker*tSACk kj~jjjjjjjjjjk k k k k k kkk --****************************************************************************** -- SUMMARY --****************************************************************************** --Description: -- This behavior allows sprites to be navigated to with the tab key. -- --Notes: -- For additional information on using Accessibility sprites, please read the -- comments section for the "Accessibility Target" behavior. -- --Usage: -- 1) Apply the CONTROL behaviors as described in the "Accessibility Target" -- behavior's comments section. -- -- 2) Apply this behavior to a sprite to allow it to be tabbed to. For -- editable text sprites use the "Edit Text Item" behavior instead. -- -- 3) Apply the "Group Order" behavior to specify the tab order for this sprite. -- -- 4) When the user tabs to this sprite and presses return, the Lingo entered -- in the GetPropertyDescriptionList handler is executed. -- --History: -- 06 June 2002. Kraig Mentor. Initial File. -- -- -- --****************************************************************************** -- AUTHOR DEFINED PROPERTIES --****************************************************************************** property pGroupName ------ String: The name of the group which will perform the -- action. property pDoCommand ------ String. The user may instigate an action by pressing -- the return key when this sprite has focus. Enter the -- Lingo string, if any, to do when return is pressed. -- For example, " go frame "Karl" ". -- -- -- --****************************************************************************** -- GENERAL PROPERTIES --****************************************************************************** property pAlert ------------------ Property List. Tracks the error messages that -- have been given to the user. property pDataList --------------- Property List. Used for intersprite messaging. property pInitialized ------------ Boolean. True once the initialization handler -- has run. property pMember ----------------- Member. The member of this sprite. property pQueuedTriggeredEvents -- Property list. Contains a queue of handlers to -- be executed at the next enterFrame event. property pSprite ----------------- Sprite. This sprite. property pStateOK ---------------- Boolean. True when the memb