Packagecom.pcthomatos.swfseo
Classpublic class SWFSEO

SWFSEO is the main class of the SWFSEO Framework.

This class should to be instantiated in a standalone main swf. This main swf will act as the main controller your swf website.

The object created from the SWFSEO class does 4 things:
  1. Preloads all assets specified on SEO friendly html pages.
  2. Based on the data loaded in from SEO friendly html pages:
    • Creates navigation and [infinite subnavigation].
    • Breaks out the workflow of your flash site into individual page swfs, [navigation swfs], and [template swfs].

  3. Creates automatic deep linking capability for each "page" with the use of SWFAddress.
  4. Provides easy tracking for all "page clicks".
*Note: []: optional

View the examples.

See also

SWFSEO - Getting Started.
SWFSEO - Navigation Settings.
com.pcthomatos.ultraloader.UltraLoader
com.pcthomatos.swfseo.swfResources.SWFSEOUL
com.pcthomatos.ultraloader.types
com.pcthomatos.swfseo.swfResources.SWFSEOPageEvent
com.pcthomatos.swfseo.swfResources.SWFSEONavBtnEvent


Public Properties
 PropertyDefined by
  lockNav : Boolean
[write-only] For enabling or disabling the locking of your navigation's position when the swf website is being scrolled.
SWFSEO
  navBold : Object
[write-only] Sets the bold state of navigation text.
SWFSEO
  navFont : String
[write-only] Sets the font face of navigation text.
*It is recommended that you embed your fonts using a fonts.swf file, and registering the font with in global font list.

*Note: this is ignored when using swfs for navigation.
SWFSEO
  navItalic : Object
[write-only] Sets the italic state of navigation text.
SWFSEO
  navKerning : Object
[write-only] Sets the kerning state of navigation text.
SWFSEO
  navLetterSpacing : Object
[write-only] Sets the letter spacing of navigation text.
SWFSEO
  navOffTextColor : uint
[write-only] Sets the off state text color of navigation text.

*Note: this is ignored when using swfs for navigation.
SWFSEO
  navOnTextColor : uint
[write-only] Sets the active state text color of navigation text.

*Note: this is ignored when using swfs for navigation.
SWFSEO
  navOverTextColor : uint
[write-only] Sets the MouseOver text color of navigation text.

*Note: this is ignored when using swfs for navigation.
SWFSEO
  navSize : Object
[write-only] Sets the font size of navigation text.

*Note: this is ignored when using swfs for navigation.
SWFSEO
  navUnderline : Object
[write-only] Sets the underline state of navigation text.
SWFSEO
  preloadBufferOnly : Boolean
[write-only] Enables or disables the preloading of a sound's buffer (8 seconds) or the entire sound.

If set to true, swf website loads faster.
SWFSEO
  preloaderBarBorderColor : uint
[write-only] Sets the preloader loader bar border color.
SWFSEO
  preloaderBarColor : uint
[write-only] Sets the preloader loader bar color.
SWFSEO
  preloaderBytesColor : uint
[write-only] Sets the preloader text color for the bytes loaded / bytes total text.
SWFSEO
  preloaderCustomClass : Class
[write-only] Sets a preloader Custom Class so you can design your own.
SWFSEO
  preloaderDisplay : Boolean
[write-only] Sets Determines whether to display a preloader or not.
SWFSEO
  preloaderTextColor : uint
[write-only] Sets the preloader text color for the preloader status text ("Initializing Loader", "Loading...").
SWFSEO
  scrollbarsEnabled : Boolean
[write-only] For enabling or disabling site scrollbars.

If set to true, website scrollbars appear whenever the window is smaller than the website's minimum size.
If set to false, no scrollbars will appear regardless of browser size.
SWFSEO
  styleNav : Class
[write-only] Sets the navigation style.

The classes to choose from are as follows:

Basic for simple click through navigation.

Dissolve for dissolves of both navigation and page transitions.

Tween for a preset tween motion of your navigation and dissolves of page transitions.

Transition for custom transition effects via event dispatches to each swf.
SWFSEO
  swfMinHeight : int
[write-only] Sets the global minimum height of the swf website's height - no page can be smaller than this.
SWFSEO
  swfMinWidth : int
[write-only] Sets the global minimum width of the swf website's width - no page can be smaller than this.
SWFSEO
  tabFocusRect : Boolean
[write-only] Enables or disables a rectangle from appearing around the currently focused navigation button via key tabbing.
SWFSEO
  tabFocusRectColor : uint
[write-only] Sets the color of the rectangle appearing around the currently focused navigation button via key tabbing.
SWFSEO
  tabNavEnabled : Boolean
[write-only] Enables or disables navigation from being included to the tab order.

If set to true, navigation is included in the tab order.
If set to false, navigation is not included in the tab order.
*Note: If a page is active it's navigation button is temporarily removed from the tab order.
SWFSEO
  trackingFunction : Function
[write-only] Executes the function contents on every SWFAddressEvent.CHANGE dispatch.

To disable tracking comment out everything in this function
SWFSEO
  useBrowserScrollbars : Boolean
[write-only] Determines if scrolling is controlled with browser scrollbars or custom flash scrollbars.

If set to true, website scrolling is controlled by the browser.
SWFSEO
Public Methods
 MethodDefined by
  
SWFSEO(stageP:Stage)
Creates a SWFSEO object that will be used to load in your assets and control your swf website.
SWFSEO
  
load():void
Activates SWFSEO.

Once all SWFSEO properties have been set, run this method to begin loading.
SWFSEO
Property detail
lockNavproperty
lockNav:Boolean  [write-only]

For enabling or disabling the locking of your navigation's position when the swf website is being scrolled.

If set to true, navigation will be vertically locked when scrollbars are used. Navigation will still scroll horizontally. Flash Scrollbars will be used.
If set to false, navigation will be part of the page and will scroll when scrollbars are used. Browser Scrollbar will be used.

The default value is false.

Implementation
    public function set lockNav(value:Boolean):void
navBoldproperty 
navBold:Object  [write-only]

Sets the bold state of navigation text.
Options are: true or false.

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navBold(value:Object):void

See also

navFontproperty 
navFont:String  [write-only]

Sets the font face of navigation text.
*It is recommended that you embed your fonts using a fonts.swf file, and registering the font with in global font list.

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navFont(value:String):void

See also

navItalicproperty 
navItalic:Object  [write-only]

Sets the italic state of navigation text.
Options are: true or false

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navItalic(value:Object):void

See also

navKerningproperty 
navKerning:Object  [write-only]

Sets the kerning state of navigation text.
Options are: true or false.

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navKerning(value:Object):void

See also

navLetterSpacingproperty 
navLetterSpacing:Object  [write-only]

Sets the letter spacing of navigation text.
Value can be any number.

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navLetterSpacing(value:Object):void

See also

navOffTextColorproperty 
navOffTextColor:uint  [write-only]

Sets the off state text color of navigation text.

*Note: this is ignored when using swfs for navigation.

The default value is 0xBFBDFB.

Implementation
    public function set navOffTextColor(value:uint):void

See also

navOnTextColorproperty 
navOnTextColor:uint  [write-only]

Sets the active state text color of navigation text.

*Note: this is ignored when using swfs for navigation.

The default value is 0xFFFFFF.

Implementation
    public function set navOnTextColor(value:uint):void

See also

navOverTextColorproperty 
navOverTextColor:uint  [write-only]

Sets the MouseOver text color of navigation text.

*Note: this is ignored when using swfs for navigation.

The default value is 0x00FF00.

Implementation
    public function set navOverTextColor(value:uint):void

See also

navSizeproperty 
navSize:Object  [write-only]

Sets the font size of navigation text.

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navSize(value:Object):void

See also

navUnderlineproperty 
navUnderline:Object  [write-only]

Sets the underline state of navigation text.
Options are: true or false.

*Note: this is ignored when using swfs for navigation.

The default value is null.

Implementation
    public function set navUnderline(value:Object):void

See also

preloadBufferOnlyproperty 
preloadBufferOnly:Boolean  [write-only]

Enables or disables the preloading of a sound's buffer (8 seconds) or the entire sound.

If set to true, swf website loads faster. The preloader waits until enough sound is buffered and renders movie while the rest loads in the background.
If set to false, swf website will not render until sounds are fully loaded. Best used on unreliable servers.

The default value is true.

Implementation
    public function set preloadBufferOnly(value:Boolean):void
preloaderBarBorderColorproperty 
preloaderBarBorderColor:uint  [write-only]

Sets the preloader loader bar border color.

The default value is 0x666666.

Implementation
    public function set preloaderBarBorderColor(value:uint):void

See also

preloaderBarColorproperty 
preloaderBarColor:uint  [write-only]

Sets the preloader loader bar color.

The default value is 0x66FF66.

Implementation
    public function set preloaderBarColor(value:uint):void

See also

preloaderBytesColorproperty 
preloaderBytesColor:uint  [write-only]

Sets the preloader text color for the bytes loaded / bytes total text.

The default value is 0xFF6666.

Implementation
    public function set preloaderBytesColor(value:uint):void

See also

preloaderCustomClassproperty 
preloaderCustomClass:Class  [write-only]

Sets a preloader Custom Class so you can design your own. But it must implment ULPreloaderInterface. Other preloader parameters are ignored when a custom class is used.

The default value is ULInfoScreen.

Implementation
    public function set preloaderCustomClass(value:Class):void

See also

preloaderDisplayproperty 
preloaderDisplay:Boolean  [write-only]

Sets Determines whether to display a preloader or not.

The default value is true.

Implementation
    public function set preloaderDisplay(value:Boolean):void
preloaderTextColorproperty 
preloaderTextColor:uint  [write-only]

Sets the preloader text color for the preloader status text ("Initializing Loader", "Loading...").

The default value is 0xFFFFFF.

Implementation
    public function set preloaderTextColor(value:uint):void

See also

scrollbarsEnabledproperty 
scrollbarsEnabled:Boolean  [write-only]

For enabling or disabling site scrollbars.

If set to true, website scrollbars appear whenever the window is smaller than the website's minimum size.
If set to false, no scrollbars will appear regardless of browser size.

The default value is true.

Implementation
    public function set scrollbarsEnabled(value:Boolean):void

See also

styleNavproperty 
styleNav:Class  [write-only]

Sets the navigation style.

The classes to choose from are as follows:

Basic for simple click through navigation.

Dissolve for dissolves of both navigation and page transitions.

Tween for a preset tween motion of your navigation and dissolves of page transitions.

Transition for custom transition effects via event dispatches to each swf. The old page transistions out first and then the new page transitions in afterward. If event listeners are not set in a page swf then Transition will behave like Basic

TransitionTwoPages for custom transition effects via event dispatches to each swf. The old page transitions out and new page transitions in at the same time. If event listeners are not set in a page swf then TransitionTwoPages will behave like Basic


You can also create custom nav style classes. Just follow any of the other nav style classes in com.pcthomatos.swfseo.navStyles as template and save in the same folder path.

The default value is Basic.

Implementation
    public function set styleNav(value:Class):void

See also

swfMinHeightproperty 
swfMinHeight:int  [write-only]

Sets the global minimum height of the swf website's height - no page can be smaller than this.

If scrollbarsEnabled is set to true, these height and width settings will control when scrollbars will be visible.
If the browser window is smaller than the root swf's size then scrollbars will appear.
If the browser window is larger that the root swf's size, the root swf will by default, center horizontally. This will happen regardless of the value of scrollbarsEnabled.

*Note: If individual pages are higher than the root swf they will override the root swf's minimum height. But if they are smaller the root swf's height takes precedence.

The default value is 550.

Implementation
    public function set swfMinHeight(value:int):void

See also

swfMinWidthproperty 
swfMinWidth:int  [write-only]

Sets the global minimum width of the swf website's width - no page can be smaller than this.

If scrollbarsEnabled is set to true, these height and width settings will control when scrollbars will be visible.
If the browser window is smaller than the root swf's size then scrollbars will appear.
If the browser window is larger that the root swf's size, the root swf will by default, center horizontally. This will happen regardless of the value of scrollbarsEnabled.

*Note: If individual pages are wider than the root swf they will override the root swf's minimum width. But if they are smaller the root swf's width takes precedence.

The default value is 920.

Implementation
    public function set swfMinWidth(value:int):void

See also

tabFocusRectproperty 
tabFocusRect:Boolean  [write-only]

Enables or disables a rectangle from appearing around the currently focused navigation button via key tabbing.

If set to true, a rectangle will appear highlighting which navigation button has focus.
If set to false, no rectangle will appear.

The default value is true.

Implementation
    public function set tabFocusRect(value:Boolean):void

See also

tabFocusRectColorproperty 
tabFocusRectColor:uint  [write-only]

Sets the color of the rectangle appearing around the currently focused navigation button via key tabbing.

The default value is 0xCCCCCC.

Implementation
    public function set tabFocusRectColor(value:uint):void

See also

tabNavEnabledproperty 
tabNavEnabled:Boolean  [write-only]

Enables or disables navigation from being included to the tab order.

If set to true, navigation is included in the tab order.
If set to false, navigation is not included in the tab order.
*Note: If a page is active it's navigation button is temporarily removed from the tab order.

The default value is true.

Implementation
    public function set tabNavEnabled(value:Boolean):void

See also

trackingFunctionproperty 
trackingFunction:Function  [write-only]

Executes the function contents on every SWFAddressEvent.CHANGE dispatch.

To disable tracking comment out everything in this function

The default value is function():void{}.

Implementation
    public function set trackingFunction(value:Function):void

Example
For Google Analytics:
          var swfseo:SWFSEO = new SWFSEO(stage);

          swfseo.trackingFunction = function():void{
                    //Note that pageTracker._trackPageview has been renamed to googlePageTracker._trackPageview because of a SWFAddress duplication bug
                    ExternalInterface.call("googlePageTracker._trackPageview", SWFAddress.getValue());
                }
         

For Webtrends SDC:
          var swfseo:SWFSEO = new SWFSEO(stage);

          swfseo.trackingFunction = function():void{
                    ExternalInterface.call("dcsMultiTrack","DCS.dcssip","www.yoursitegoeshere.com","DCS.dcsuri", SWFAddress.getValue(),"WT.ti", SWFAddress.getTitle());
                }
         

useBrowserScrollbarsproperty 
useBrowserScrollbars:Boolean  [write-only]

Determines if scrolling is controlled with browser scrollbars or custom flash scrollbars.

If set to true, website scrolling is controlled by the browser. Liquid Layout" websites are difficult to build in this mode.
If set to false, website scrolling is controlled by custom flash scrollbars.

The default value is false.

Implementation
    public function set useBrowserScrollbars(value:Boolean):void
Constructor detail
SWFSEO()constructor
public function SWFSEO(stageP:Stage)

Creates a SWFSEO object that will be used to load in your assets and control your swf website.

Parameters
stageP:Stage — An instance of Stage.

See also

Method detail
load()method
public function load():void

Activates SWFSEO.

Once all SWFSEO properties have been set, run this method to begin loading.

*Note: The instance of SWFSEO needs to continue to run in order to control your swf website.

Examples

// SWFSEO 1.72: Search Engine Optimization Framework for Flash - pcthomatos.com
// Copyright (c) 2009 Peterangelo C. Thomatos (pcthomatos.com) and is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
package{
    import com.asual.swfaddress.SWFAddress;

    import com.pcthomatos.swfseo.*;
    import com.pcthomatos.swfseo.navStyles.*;

    import flash.display.StageScaleMode;
    import flash.display.StageAlign;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.external.ExternalInterface;

    public class SWFSEOExample extends Sprite {
        private var swfseo:SWFSEO;

        public function SWFSEOExample():void {
            if (stage)init_Listener();
            else addEventListener(Event.ADDED_TO_STAGE, init_Listener);
        }

        private var init_Listener:Function = function (e:Event = null):void {
            removeEventListener(Event.ADDED_TO_STAGE, init_Listener);

            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            stage.addEventListener(Event.RESIZE, resizeListener);

            loadBg();

            swfseo = new SWFSEO(stage);
            setSWFSEO();
            swfseo.load();


            cleanMain();
            cleanMain = null;
        }

        private var setSWFSEO:Function = function ():void { // all these settings are optional if the are not set defualt values will be used.
            swfseo.swfMinWidth = 1300;
            swfseo.swfMinHeight = 700;
            swfseo.scrollbarsEnabled = true;
            swfseo.lockNav = true;
            swfseo.styleNav = Transition;
            swfseo.tabNavEnabled = true;
            swfseo.tabFocusRect = true;
            swfseo.tabFocusRectColor = 0xCCCCCC;
            swfseo.navFont = "Blackadder ITC";
            swfseo.navSize = 20;
            swfseo.navOverTextColor = 0x00FF00;
            swfseo.navOffTextColor = 0xBFBDFB;
            swfseo.navOnTextColor = 0xFFFFFF;
            swfseo.navBold = true;
            swfseo.navItalic = true;
            swfseo.navUnderline = true;
            swfseo.navKerning = true;
            swfseo.navLetterSpacing = null;
            swfseo.preloaderTextColor = 0xFFFFFF;
            swfseo.preloaderBytesColor = 0xFF6666;
            swfseo.preloaderBarColor = 0x66FF66;
            swfseo.preloaderBarBorderColor = 0x666666;
            swfseo.preloadBufferOnly = true;
            swfseo.trackingFunction = function():void {
                ExternalInterface.call("googlePageTracker._trackPageview", SWFAddress.getValue());
            }
        }

        private final function resizeListener(e:Event):void {// place code here if you want your background to stretch or center on resize

        }

        private var loadBg:Function = function ():void {// if you want an overall background image or something that stretches on resize - place code in here and add code to the resizeListener if necessary

        }

        private var cleanMain:Function = function ():void {
            loadBg = null;
            setSWFSEO = null;
            init_Listener = null;

            swfseo = null;
        }
    }
}