| Package | com.pcthomatos.swfseo.swfResources |
| Class | public final class SWFSEOPageEvent |
SWFSEOPageEvent class contains all the Event Types to be used be used in each of your page swfs and template swfs.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. 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 foregroundTransition.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.
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
| Constant | Defined 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:
| 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 | ||
| ADD | constant |
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
...
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_COMPLETE | constant |
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
function dispatchAdd_Listener(e:TimerEvent):void {
dispatchEvent(new Event(SWFSEOPageEvent.ADD_COMPLETE));
timerAdd.reset();
}
| PAGE_CHANGE | constant |
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
...
addEventListener(SWFSEOPageEvent.PAGE_CHANGE, update_Listener);
}
function update_Listener(e:Event):void {
if(pageName == "aboutus"){
//reset for about us page
}
| READY | constant |
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:
SWFSEOUL.UL static object which contains all the assets loaded in with swfseo.See also
...
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.
...
| REMOVE | constant |
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
...
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_COMPLETE | constant |
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
function dispatchRemove_Listener(e:TimerEvent):void {
dispatchEvent(new Event(SWFSEOPageEvent.REMOVE_COMPLETE));
timerRemove.reset();
}