stop(); // set properties of mask that appears when documents are edited ( ARGB Color, Blur Amount ) fMaster.setMaskProperties( 0xff00000, 2 )
// hide page elements until fcms is initialized logo._visible = false; fMenu._visible = false; search_btn._visible = false; search_txt._visible = false;
// subscribe to fcmsInit event fMaster.addEventListener( "fcmsInit", this ); // fcmsInit event is triggered when tag and doctype information is loaded (used when working with doc relations) function fcmsInit( eo:Object ) { // if first parameter of fMenu.addBranch method is number // nodes will copy tag tree of a tag with same id // second parameter defines position of a node in fMenu tree where branch needs to be added fMenu.addBranch( 2, [ 1 ] ); fMenu.addBranch( 3, [ 2 ] ); fMenu.addBranch( 4, [ 3 ] ); fMenu.addBranch( 5, [ 4 ] ); fMenu.addBranch( 6, [ 5 ] ); fMenu.addBranch( 7, [ 6 ] ); fMenu.addBranch( 8, [ 7 ] ); fMenu.addBranch( [ "Mini", "Wheels & Tires", "Accessories" ], [ 8 ] ); // subscribe to click event of fMenu component fMenu.addEventListener( "click", _root ); // unhide page elements logo._visible = true; fMenu._visible = true; search_btn._visible = true; search_txt._visible = true; // define footer footer_txt.htmlText = '">asfunction:_root.onFooter,About Us">About Us | '; footer_txt.htmlText += '">asfunction:_root.onFooter,Contact">Contact | '; footer_txt.htmlText += '">asfunction:_root.onFooter,rss">RSS | '; footer_txt.htmlText += '">asfunction:_root.onFooter,admin">Admin'; fcms.Tools.setHover( footer_txt ); // SEOCallBack is false when fCMSPro html template does not contain information about the document. if ( !eo.SEOCallBack ) gotoAndStop( "home" ); }
/* ########### MENU HANDLING ############## */
// fMenu.click listener function click( eo:Object ) { // when tag node is clicked event object has query property defined if ( eo.query ) { var q = eo.query; // header documents are graphic elements different for each part of the site // activeHeader variable will tell us which header should be active activeHeader = eo.node.parent.label; } else { // otherwise, check if it is first fMenu level // and if tag with that name exists, create query var tagID:Number = fMaster.getTagIDByLabel( [ eo.node.label ] ); if ( tagID != undefined ) { var q = fMaster.getQuery(); q.taggedWith( tagID, true ); q.addReturnRelation( "tagged_with" ); activeHeader = eo.node.label; } } // if query is defined if ( q ) { //trace(q); // if current frame is where index is, just refresh it if ( _currentframe == 17 ) { refreshIndex( q ); // otherwise, invoke query } else { fMaster.invoke({query:q,queryTarget:"fIndex"}); gotoAndStop("index"); } // if there is no query } else { if ( eo.node.label == "Home" ) gotoAndStop("home"); } }
/* ########### HEADER ############## */
// these two variables are used for displaying header for each section var activeHeader:String = ""; var currentHeader:String = ""; // function that is called to set proper content in the header function refreshHeader() { if ( currentHeader == activeHeader ) return; header_template.query = fMaster.getQuery(); header_template.query.addFilter( "$DOCTYPE", "=", "header" ); header_template.query.addFilter( "title", "=", activeHeader ); header_template.refresh(); currentHeader = activeHeader; }
/* ########### SEARCH ############## */
// see search tutorial for more info search_txt.backgroundColor = 0x464646; search_btn.onRelease = function() { if ( search_txt.text != "" ) { var q = fMaster.getQuery(); q.addFilter( "$DOCTYPE", "=", "item" ); q.addFilter( "*", "FULL_TEXT", search_txt.text ); activeHeader = "Search Results"; if ( _currentframe == 17 ) refreshIndex( q ); else { fMaster.invoke( { query:q, queryTarget:"fIndex" }); gotoAndStop( "index" ); } } }
/* ########### FOOTER ############## */
// runs when text in the footer is clicked function onFooter( str:String ) { switch ( str ) { case "About Us": activeHeader = "About Us"; if ( _currentframe == 24 ) refreshCommon(); else gotoAndStop("common"); break; case "Contact": activeHeader = "Contact"; if ( _currentframe == 24 ) refreshCommon(); else gotoAndStop("common"); break; case "rss": break; case "admin": fMaster.start(); break; default: break; } }
|