« back

Global Navigation v2: Public Methods

create

create():void
  • This is needed since version 2.15 to start the process of the navigation creation. Because before, in some rare situations, the navigation listeners were not added properly when the navigation was starting. So it should look something like this:
// create Navigation
navigationManager = new NavigationManager2(this, "xml/navig.xml");
navigationManager.setFadeInOnMouseOver(false);
navigationManager.setFade(true);
navigationManager.setFadeInChainDelay(0.3);
// etc.
 
// Event Listeners
navigationManager.addEventListener(NavigationEvent.MC_ACTIVATED, btnActivateHandler,false,0,true);
navigationManager.addEventListener(NavigationEvent.MC_FADE_IN, btnsFadeIn,false,0,true);
navigationManager.addEventListener(NavigationEvent.MC_FADE_OUT, btnsFadeOut, false, 0, true);
navigationManager.addEventListener(NavigationEvent.LOADING_COMPLETE, loadingCompleteHandler, false, 0, true);
// etc.
 
// Now all properties are set, all listeners are added: it's save to create the navigation:
navigationManager.create();                       

setFade

setFade(fade:Boolean):void
  • Default is “false”.
  • If “false”, the children of a button are visible immediatly at rollOver (if setFadeInOnMouseOver is “true”) or release (when the button is clicked). No onMouseOver event is dispatched.
  • If “true”, the onMouseOver event is dispatched, where you have to handle the fading in of the children buttons by yourself.

setFadeInOnMouseOver

setFadeInOnMouseOver(fade:Boolean):void
  • Default is “true”. Note: If you use the xml attribute btnMakeRoomY, set this to “false”: setFadeInOnMouseOver(false). The combination is not (yet) working as expected!

getFadeInOnMouseOver

getFadeInOnMouseOver():Boolean

setFadeInDepth

setFadeInDepth(value:String)
  • “front” or “back”. Default is “front”.

setFadeOutTimerDelay

setFadeOutTimerDelay(delay:Number):void
  • Default is 2 seconds.
  • The time the children buttons remain visible when the mouse has rolled out before they fade out again.

setFadeInChainDelay

setFadeInChainDelay(delay:Number):void
  • Default is “0”.
  • The time the children of a button wait before they fade in when a deeplink is active. This is useful if you have a longer animation for fading in buttons, to have a more sequential over all animation. See examples, select example Nr. 8 and click on “Deeplink-Demo” at the bottom.

setKeepRolloverStatus

setKeepRolloverStatus(value:Boolean)

getKeepRolloverStatus

getKeepRolloverStatus():Boolean

setAlwaysHideChildren

setAlwaysHideChildren(value:Boolean, hideAtRelease:Boolean = false)
  • Default is “false”. NOTE: setAlwaysHideChildren depends on setFadeInOnMouseOver. If setFadeInOnMouseOver is “false”, setAlwaysHideChildren will also be “false”. It is only effective if setFadeInOnMouseOver is “true”.

getAlwaysHideChildren

getAlwaysHideChildren():Boolean

setBtnLabelTextNewLine

setBtnLabelTextNewLine(value:String):void
  • If you have a navigation menu label that is too long, you can store it in the xml file like this: btnLabel=“This is a too$long menu label”. You can than use a character you like to use as a newline, in this example I have choosen “$”. You now have to tell the navigationManager about this: navigationManager.setBtnLabelTextNewLine(“$”). Now the label will be split at “$”.

getBtnLabelTextNewLine

setBtnLabelTextNewLine():String

setBtnDepths

setBtnDepths(rollOutDepth:String, rollOverDepth:String, pressDepth:String, releaseDepth:String, deactivateDepth:String)
  • Values are “front” or “back”. Default is “front”, “front”, “front”, “front”, “front”

setAutoActivateDelay

setAutoActivateDelay(n:Number)

getBtnsByID

getBtnsByID(idArr:Array = null):Array
  • Returns an array of NavigationButtons
// Example:
var b:Array = navigationManager.getBtnsByID(["home","about_us","products"]);
trace(b[0].btnSize)
trace(b[1].initX)
trace(b[2].makeRoomY)

getSiblings

getSiblings(id:String, skipBtnID:Boolean = true):Array
  • Returns an array of NavigationButtons of the same level. If you get the siblings of a btn, than this btn will not be in the array. This is the default. If you want all buttons in the array (including the one you called the method with), use skipBtnID = false.

getParent

getParent(id:String):Object
  • Returns the parent button (NavigationButton) of a button

getChildren

getChildren(id:String):Array
  • Returns the children of a button as an array of NavigationButtons

activateBtn

activateBtn(id:String, dispatch:Boolean = true):void
  • Activates a button. If dispatch is “false”, only the button status will change, but no event will be dispatched. This is required for example when a deeplink is fired and the content is already loading, the button has to reflect the change but should not activate anything. Espacially in Gaia this is useful, because there the button only reacts to the “goto” event.

getBranchForGaia

getBranchForGaia(id:String):String
  • Needed for Gaia projects. There are situations where you need the branches. See the documentation for more info.

deactivateAll

deactivateAll():void
  • Deactivates all buttons

setSuspendAfterInit

setSuspendAfterInit(value:Boolean):void
  • Default is “false”. If “true”, the navigation will be suspended (not visible) right after initialisation. This comes in very handy if you need to wait for an intro to finish or some assets to be loaded. When everything is ready, you can release the navigation. See examples, select example Nr. 16.

releaseSuspendAfterInit

releaseSuspendAfterInit():void
  • This only makes sense if setSuspendAfterInit is “true”, otherwise nothing is suspended and therefor nothing will be released. See examples, select example Nr. 16.

getSuspended

getSuspended():Boolean

The usage only makes sense if setSuspendAfterInit() is true. You can check if the navigation is still suspended or already released.

Example:

releaseNavigBtn.addEventListener(MouseEvent.CLICK,btnReleaseNavigHandler);
function btnReleaseNavigHandler(event:MouseEvent) {
    if (navigationManager.getSuspended()) navigationManager.releaseSuspendAfterInit();
}
resetNavigBtn.addEventListener(MouseEvent.CLICK,btnResetNavigHandler);
function btnResetNavigHandler(event:MouseEvent) {
    if (!navigationManager.getSuspended()) navigationManager.resetNavigation();
}

resetNavigation

resetNavigation():void
  • If setSuspendAfterInit is set to “true”, resetNavigation will hide the navigation and deactivate all buttons. If setSuspendAfterInit is “false”, all buttons will be deactivated but the navigation will remain visible.
  • Also see releaseSuspendAfterInit()

getBtnsContainer

getBtnsContainer():MovieClip
  • Get the container where all buttons are added into

relayoutButtons

relayoutButtons(btn:NavigationButton2 = null, tweenTime:Number = 0, delay:Number = 0):void
  • Needed if you have changed the button label text at runtime, to re-align the buttons after they have changed their size.
global-navigation2-public-methods.txt · Last modified: 2011/11/11 18:55 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki