| Package | com.soma.events |
| Class | public class ParserEvent |
| Inheritance | ParserEvent 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:
NodeParser events to announce when the instance will parser XML nodes, when properties will be applied to an asset, when an external asset (external file) has been loaded and when the parser is fully finished with its tasks.
The 4 events type WILL_SET_PROPERTIES, WILL_SET_BASEUI_PROPERTIES, WILL_PARSE and WILL_LOAD can be default prevented.
var parser:NodeParser = new NodeParser(Soma.getInstance().library);
parser.addEventListener(ParserEvent.WILL_PARSE, events);
parser.addEventListener(ParserEvent.WILL_LOAD, events);
parser.addEventListener(ParserEvent.WILL_SET_PROPERTIES, events);
parser.addEventListener(ParserEvent.WILL_SET_BASEUI_PROPERTIES, events);
parser.addEventListener(ParserEvent.ASSET_LOADED, events);
parser.addEventListener(ParserEvent.COMPLETE, events);
See also
| Property | Defined by | ||
|---|---|---|---|
| asset : * Asset instance created, it can be a DisplayObject, a SomaLoaderItem or anything.
| ParserEvent | ||
| node : XML Current XML node that is (or will be) parsed.
| ParserEvent | ||
| parser : NodeParser
Instance of the current NodeParser instance that is dispatching the event.
| ParserEvent | ||
| Method | Defined by | ||
|---|---|---|---|
|
ParserEvent(type:String, parser:NodeParser, node:XML = null, asset:Boolean = null, bubbles:Boolean = true, cancelable:* = false)
Creates a ParserEvent instance.
| ParserEvent | ||
|
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. | ParserEvent | ||
|
toString():String
Returns a formatted string to display event information.
| ParserEvent | ||
| Constant | Defined by | ||
|---|---|---|---|
| ASSET_LOADED : String = "com.soma.events.ParserEvent.ASSET_LOADED" [static] Indicates when an external asset (external file such as an image) has been loaded by the SomaLoader instance used with the NodeParser instance.
parser.addEventListener(ParserEvent.ASSET_LOADED, eventHandler); | ParserEvent | ||
| COMPLETE : String = "com.soma.events.ParserEvent.COMPLETE" [static] Indicates when a NodeParser instance is fully finished with its tasks (assets instantiated, loaded if necessary and properties applied).
parser.addEventListener(ParserEvent.COMPLETE, eventHandler); | ParserEvent | ||
| WILL_LOAD : String = "com.soma.events.ParserEvent.WILL_LOAD" [static] Indicates when a NodeParser instance is about to load an external asset (external file such as an image).
Can be default prevented: event.preventDefault(). | ParserEvent | ||
| WILL_PARSE : String = "com.soma.events.ParserEvent.WILL_PARSE" [static] Indicates when a NodeParser instance is about to parse the XML nodes to create assets.
Can be default prevented: event.preventDefault(). | ParserEvent | ||
| WILL_SET_BASEUI_PROPERTIES : String = "com.soma.events.ParserEvent.WILL_SET_BASEUI_PROPERTIES" [static] Indicates when a NodeParser instance is about to apply BaseUI properties (such as top, right and so on) found in the XML node to the asset created.
Can be default prevented: event.preventDefault(). | ParserEvent | ||
| WILL_SET_PROPERTIES : String = "com.soma.events.ParserEvent.WILL_SET_PROPERTIES" [static] Indicates when a NodeParser instance is about to apply properties found in the XML node to the asset created.
Can be default prevented: event.preventDefault(). | ParserEvent | ||
| asset | property |
public var asset:*Asset instance created, it can be a DisplayObject, a SomaLoaderItem or anything.
| node | property |
public var node:XMLCurrent XML node that is (or will be) parsed.
| parser | property |
public var parser:NodeParserInstance of the current NodeParser instance that is dispatching the event.
| ParserEvent | () | constructor |
public function ParserEvent(type:String, parser:NodeParser, node:XML = null, asset:Boolean = null, bubbles:Boolean = true, cancelable:* = false)Creates a ParserEvent instance.
Parameterstype:String — The type of the event, accessible as ParserEvent.type.
|
|
parser:NodeParser — current NodeParser instance.
|
|
node:XML (default = null) — current XML node.
|
|
asset:Boolean (default = null) — current asset.
|
|
bubbles:Boolean (default = true) — Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
|
|
cancelable:* (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.
|
| toString | () | method |
public override function toString():StringReturns a formatted string to display event information.
ReturnsString — A String.
|
| ASSET_LOADED | constant |
public static const ASSET_LOADED:String = "com.soma.events.ParserEvent.ASSET_LOADED" Indicates when an external asset (external file such as an image) has been loaded by the SomaLoader instance used with the NodeParser instance.
parser.addEventListener(ParserEvent.ASSET_LOADED, eventHandler);
| COMPLETE | constant |
public static const COMPLETE:String = "com.soma.events.ParserEvent.COMPLETE" Indicates when a NodeParser instance is fully finished with its tasks (assets instantiated, loaded if necessary and properties applied).
parser.addEventListener(ParserEvent.COMPLETE, eventHandler);
| WILL_LOAD | constant |
public static const WILL_LOAD:String = "com.soma.events.ParserEvent.WILL_LOAD" Indicates when a NodeParser instance is about to load an external asset (external file such as an image).
Can be default prevented: event.preventDefault().
parser.addEventListener(ParserEvent.WILL_LOAD, eventHandler);
| WILL_PARSE | constant |
public static const WILL_PARSE:String = "com.soma.events.ParserEvent.WILL_PARSE" Indicates when a NodeParser instance is about to parse the XML nodes to create assets.
Can be default prevented: event.preventDefault().
parser.addEventListener(ParserEvent.WILL_PARSE, eventHandler);
| WILL_SET_BASEUI_PROPERTIES | constant |
public static const WILL_SET_BASEUI_PROPERTIES:String = "com.soma.events.ParserEvent.WILL_SET_BASEUI_PROPERTIES" Indicates when a NodeParser instance is about to apply BaseUI properties (such as top, right and so on) found in the XML node to the asset created.
Can be default prevented: event.preventDefault().
parser.addEventListener(ParserEvent.WILL_SET_BASEUI_PROPERTIES, eventHandler);
| WILL_SET_PROPERTIES | constant |
public static const WILL_SET_PROPERTIES:String = "com.soma.events.ParserEvent.WILL_SET_PROPERTIES" Indicates when a NodeParser instance is about to apply properties found in the XML node to the asset created.
Can be default prevented: event.preventDefault().
parser.addEventListener(ParserEvent.WILL_SET_PROPERTIES, eventHandler);