Packagecom.pcthomatos.swfseo.swfResources
Classpublic final class SWFSEOPageEvent

The SWFSEOPageEvent class contains all the Event Types to be used be used in each of your page swfs and template swfs.

The parent of the page swf and template swf controls the dispatch of these Event types to the page swf and template swf.

If you are accessing the SWFSEOUL.ul object, the READY event type must be used by all pages regardless of navigation style. Otherwise you could be accessing assets before they have loaded. This will result in errors.
The PAGE_CHANGE is used by template.swfs only - regardless of navigation style. It helps identify which page is currently active. It is not required if you have very basic templates that don't need to change based on the page the in the foreground

The other event types must be used only if you're using the Transition.as and TransitionTwoPages.as navigation style. If you are using Transition.as, the template swf does not need to dispatch ADD_COMPLETE. However the page swf needs to dispatch ADD_COMPLETE once your enter animation has completed. That is how the "page's" dimensions are determined.


Example
A basic example of all the SWFSEOPageEvent Event types being used in the first frame of a flash file. Alternatively, this code can be placed inside a document class.
        import com.gs.TweenLite;
        import flash.events.Event;
        import flash.events.Event;

        import com.pcthomatos.swfseo.swfResources.SWFSEOPageEvent;
        import com.pcthomatos.swfseo.swfResources.SWFSEOUL;

        var ul:Object = SWFSEOUL.ul;

        var timerRemove:Timer = new Timer(500, 1);
        var timerAdd:Timer = new Timer(500, 1);

        addEventListener(SWFSEOPageEvent.READY, render_Listener);

        function render_Listener(e:Event):void{
            removeEventListener(SWFSEOPageEvent.READY, render_Listener);

            var foo:TextField = ul.gallery.maintext.gallerytext;
            foo.defaultTextFormat = new TextFormat("Helvetica", 30);
            foo.setTextFormat(new TextFormat("Helvetica", 30));
            foo.width = 1200;
            foo.embedFonts = true;
            addChild(foo);

            var photox:int = 0;
            for each(var photo:Bitmap in ul.gallery.photos){
                photo.x = photox;
                addChild(photo);
                photox += 300;
            }

            addEventListener(SWFSEOPageEvent.ADD, add_Listener);
            addEventListener(SWFSEOPageEvent.REMOVE, remove_Listener);

            timerRemove.addEventListener(TimerEvent.TIMER_COMPLETE, dispatchRemove_Listener);
            timerAdd.addEventListener(TimerEvent.TIMER_COMPLETE, dispatchAdd_Listener);

            TweenLite.to(root, 0, {scaleX:0, scaleY:0});
        }

        function remove_Listener(e:Event):void {
            TweenLite.to(root, .5, {scaleX:0, scaleY:0});
            timerRemove.start();
        }

        function dispatchRemove_Listener(e:TimerEvent):void {
            dispatchEvent(new Event(SWFSEOPageEvent.REMOVE_COMPLETE));
            timerRemove.reset();
        }

        function add_Listener(e:Event):void {
            TweenLite.to(root, .5, {scaleX:1, scaleY:1});
            timerAdd.start();
        }

        function dispatchAdd_Listener(e:TimerEvent):void {
            dispatchEvent(new Event(SWFSEOPageEvent.ADD_COMPLETE));
            timerAdd.reset();
        }

        stop();
        

See also

SWFSEOUL.ul
com.pcthomatos.swfseo.SWFSEO.styleNav


Public Constants
 ConstantDefined by
  ADD : String = "swfseoAdd"
[static] The SWFSEOPageEvent.ADD constant defines the value of the type property of the event object for a swfseoAdd event.

Once this Event is dispatched you can display a page enter animation.

*Note: This Event will only be dispatched if you are using the Transition.as navigation Style.
SWFSEOPageEvent
  ADD_COMPLETE : String = "swfseoAddComplete"
[static] The SWFSEOPageEvent.ADD_COMPLETE constant defines the value of the type property of the event object for a swfseoAddComplete event.

Once your enter animation has completed, this Event Type should be manually dispatched by your page swf.

*Note: This is only used if you are using the Transition.as navigation Style.
SWFSEOPageEvent
  PAGE_CHANGE : String = "swfseoPageChange"
[static] The SWFSEOPageEvent.PAGE_CHANGE constant defines the value of the type property of the event object for a swfseoPageChange event.

This listener is only to be used by your templates.

Set your template swf to listen for this event.
SWFSEOPageEvent
  READY : String = "swfseoReadyForUse"
[static] The SWFSEOPageEvent.READY constant defines the value of the type property of the event object for a swfseoReadyForUse event.

Once this Event is dispatched your page swf can:
  • Access the SWFSEOUL.UL static object which contains all the assets loaded in with swfseo.
  • If you're using the Transition.as navigation Style.
SWFSEOPageEvent
  REMOVE : String = "swfseoRemove"
[static] The SWFSEOPageEvent.REMOVE constant defines the value of the type property of the event object for a swfseoRemove event.

Once this Event is dispatched you can display a page exit animation.
SWFSEOPageEvent
  REMOVE_COMPLETE : String = "swfseoRemoveComplete"
[static] The SWFSEOPageEvent.REMOVE_COMPLETE constant defines the value of the type property of the event object for a swfseoRemoveComplete event.

Once your exit animation has completed, this Event Type should be manually dispatched by your page swf.

*Note: This is only used if you are using the Transition.as navigation Style.
SWFSEOPageEvent
Constant detail
ADDconstant
public static const ADD:String = "swfseoAdd"

The SWFSEOPageEvent.ADD constant defines the value of the type property of the event object for a swfseoAdd event.

Once this Event is dispatched you can display a page enter animation.

*Note: This Event will only be dispatched if you are using the Transition.as navigation Style. Used in both page and template swfs.

See also


Example
            ...
            addEventListener(SWFSEOPageEvent.ADD, add_Listener);
        }

        function add_Listener(e:Event):void {
            TweenLite.to(root, .5, {scaleX:1, scaleY:1});
            timerAdd.start();
        }

        function dispatchAdd_Listener(e:TimerEvent):void {
            dispatchEvent(new Event(SWFSEOPageEvent.ADD_COMPLETE));
            timerAdd.reset();
        }
        

ADD_COMPLETEconstant 
public static const ADD_COMPLETE:String = "swfseoAddComplete"

The SWFSEOPageEvent.ADD_COMPLETE constant defines the value of the type property of the event object for a swfseoAddComplete event.

Once your enter animation has completed, this Event Type should be manually dispatched by your page swf.

*Note: This is only used if you are using the Transition.as navigation Style. Used only in page swfs. Only page swfs can override and exceed root swf width and height.

See also


Example
After a timer animation has completed:
        function dispatchAdd_Listener(e:TimerEvent):void {
            dispatchEvent(new Event(SWFSEOPageEvent.ADD_COMPLETE));
            timerAdd.reset();
        }
        

PAGE_CHANGEconstant 
public static const PAGE_CHANGE:String = "swfseoPageChange"

The SWFSEOPageEvent.PAGE_CHANGE constant defines the value of the type property of the event object for a swfseoPageChange event.

This listener is only to be used by your templates.

Set your template swf to listen for this event. Every time it is dispatched the pageName variable from the extended template class SWFSEOTemplate is updated and you can make changes to your template based on page change. It is not required if you have very basic templates that don't need to change based on the page the in the foreground.

See also


Example
            ...
            addEventListener(SWFSEOPageEvent.PAGE_CHANGE, update_Listener);
        }

        function update_Listener(e:Event):void {
            if(pageName == "aboutus"){
            //reset for about us page
        }
        

READYconstant 
public static const READY:String = "swfseoReadyForUse"

The SWFSEOPageEvent.READY constant defines the value of the type property of the event object for a swfseoReadyForUse event.

Once this Event is dispatched your page swf can:

See also


Example
        ...
        addEventListener(SWFSEOPageEvent.READY, render_Listener);

        function render_Listener(e:Event):void{
            removeEventListener(SWFSEOPageEvent.READY, render_Listener);
            // use of SWFSEO.ul object to set local vars etc.
        ...
        

REMOVEconstant 
public static const REMOVE:String = "swfseoRemove"

The SWFSEOPageEvent.REMOVE constant defines the value of the type property of the event object for a swfseoRemove event.

Once this Event is dispatched you can display a page exit animation. Once the exit animation is complete you must dispatch REMOVE_COMPLETE.

*Note: This Event will only be dispatched if you are using the Transition.as navigation Style. Used in both page and template swfs.

See also


Example
The REMOVE and REMOVE_COMPLETE sequence:
            ...
            addEventListener(SWFSEOPageEvent.REMOVE, remove_Listener);
            timer.addEventListener(TimerEvent.TIMER_COMPLETE, dispatchRemove_Listener);
        }

        function remove_Listener(e:Event):void {
            TweenLite.to(root, .5, {scaleX:0, scaleY:0});
            timerRemove.start();
        }

        function dispatchRemove_Listener(e:TimerEvent):void {
            dispatchEvent(new Event(SWFSEOPageEvent.REMOVE_COMPLETE));
            timerRemove.reset();
        }
        

REMOVE_COMPLETEconstant 
public static const REMOVE_COMPLETE:String = "swfseoRemoveComplete"

The SWFSEOPageEvent.REMOVE_COMPLETE constant defines the value of the type property of the event object for a swfseoRemoveComplete event.

Once your exit animation has completed, this Event Type should be manually dispatched by your page swf.

*Note: This is only used if you are using the Transition.as navigation Style. Used in both page and template swfs.

See also


Example
After a timer animation has completed:
        function dispatchRemove_Listener(e:TimerEvent):void {
            dispatchEvent(new Event(SWFSEOPageEvent.REMOVE_COMPLETE));
            timerRemove.reset();
        }