| Package | com.soma.events |
| Class | public class BackgroundEvent |
| Inheritance | BackgroundEvent CairngormEvent flash.events.Event |
Author: Romuald Quantin - www.soundstep.com
Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0
Copyright:
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.
The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.
Usage:
Framework events dispatched through a single dispatcher related to the BackgroundManager (Soma.getInstance().background).
The type SHOW and HIDE are commands:
new BackgroundEvent(BackgroundEvent.SHOW, "myBackground").dispatch();
new BackgroundEvent(BackgroundEvent.HIDE, "myBackground").dispatch();
The type TRANSITION_IN and TRANSITION_OUT are not commands and the listeners can be added on the Soma class (can be default prevented):
Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_IN, eventHandler);
Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_OUT, eventHandler);
See also
| Property | Defined by | ||
|---|---|---|---|
![]() | data : *
The data property can be used to hold information to be passed with the event
in cases where the developer does not want to extend the CairngormEvent class.
| CairngormEvent | |
| id : String
id of the background (attribute id in a node child of the backgrounds node of the XML Site Definition).
| BackgroundEvent | ||
| Method | Defined by | ||
|---|---|---|---|
|
BackgroundEvent(type:String, id:String = "", bubbles:Boolean = true, cancelable:Boolean = false)
Creates a BackgroundEvent instance, the event can dispatch itself using the method dispatch (command).
| BackgroundEvent | ||
|
clone():Event
Duplicates an instance of an Event subclass.
Returns a new Event object that is a copy of the original instance of the Event object. | BackgroundEvent | ||
|
dispatch():Boolean
Dispatch this event via the Cairngorm event dispatcher.
| BackgroundEvent | ||
|
toString():String
Returns a formatted string to display event information.
| BackgroundEvent | ||
| Constant | Defined by | ||
|---|---|---|---|
| HIDE : String = "com.soma.events.BackgroundEvent.HIDE" [static] Soma command to display a background using the id from the XML Site Definition, use from anywhere in the code:
The parameter should the ID of the background (id attribute in the XML Site Definition) new BackgroundEvent(BackgroundEvent.HIDE, "myBackground").dispatch(); | BackgroundEvent | ||
| SHOW : String = "com.soma.events.BackgroundEvent.SHOW" [static] Soma command to display a background using the id from the XML Site Definition, use from anywhere in the code:
The parameter should the ID of the background (id attribute in the XML Site Definition) new BackgroundEvent(BackgroundEvent.SHOW, "myBackground").dispatch(); | BackgroundEvent | ||
| TRANSITION_IN : String = "com.soma.events.BackgroundEvent.TRANSITION_IN" [static] Indicates when a background is about to be displayed by the BackgroundManager instance (Soma.getInstance().background).
Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_IN, eventHandler); | BackgroundEvent | ||
| TRANSITION_OUT : String = "com.soma.events.BackgroundEvent.TRANSITION_OUT" [static] Indicates when a background is about to be hidden by the BackgroundManager instance (Soma.getInstance().background).
Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_OUT, eventHandler); | BackgroundEvent | ||
| id | property |
public var id:Stringid of the background (attribute id in a node child of the backgrounds node of the XML Site Definition). The id is also the DisplayObject name in the container of the backgrounds (Soma.getInstance().background.container).
| BackgroundEvent | () | constructor |
public function BackgroundEvent(type:String, id:String = "", bubbles:Boolean = true, cancelable:Boolean = false)Creates a BackgroundEvent instance, the event can dispatch itself using the method dispatch (command).
Parameterstype:String — The type of the event, accessible as BackgroundEvent.type.
|
|
id:String (default = "") — The id of the background.
|
|
bubbles:Boolean (default = true) — Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
|
|
cancelable:Boolean (default = false) — Determines whether the Event object can be canceled. The default values is false.
|
| clone | () | method |
public override function clone():Event Duplicates an instance of an Event subclass.
Returns a new Event object that is a copy of the original instance of the Event object. You do not normally call clone(); the EventDispatcher class calls it automatically when you redispatch an event—that is, when you call dispatchEvent(event) from a handler that is handling event.
The new Event object includes all the properties of the original.
Event — A new Event object that is identical to the original.
|
| dispatch | () | method |
public override function dispatch():BooleanDispatch this event via the Cairngorm event dispatcher.
ReturnsBoolean |
| toString | () | method |
public override function toString():StringReturns a formatted string to display event information.
ReturnsString — A String.
|
| HIDE | constant |
public static const HIDE:String = "com.soma.events.BackgroundEvent.HIDE" Soma command to display a background using the id from the XML Site Definition, use from anywhere in the code:
The parameter should the ID of the background (id attribute in the XML Site Definition)
new BackgroundEvent(BackgroundEvent.HIDE, "myBackground").dispatch();
| SHOW | constant |
public static const SHOW:String = "com.soma.events.BackgroundEvent.SHOW" Soma command to display a background using the id from the XML Site Definition, use from anywhere in the code:
The parameter should the ID of the background (id attribute in the XML Site Definition)
new BackgroundEvent(BackgroundEvent.SHOW, "myBackground").dispatch();
| TRANSITION_IN | constant |
public static const TRANSITION_IN:String = "com.soma.events.BackgroundEvent.TRANSITION_IN" Indicates when a background is about to be displayed by the BackgroundManager instance (Soma.getInstance().background).
Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_IN, eventHandler);
| TRANSITION_OUT | constant |
public static const TRANSITION_OUT:String = "com.soma.events.BackgroundEvent.TRANSITION_OUT" Indicates when a background is about to be hidden by the BackgroundManager instance (Soma.getInstance().background).
Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_OUT, eventHandler);