UI (library)
Overview
Summary
User Interface class to provide structured access to core Flash UI elements like Document, Timeline, etc., or issue standard warnings if not available.
Contents
Concept
The UI class is designed to get values from the Flash interface, or current document state.
The UI getters trigger standardised warnig alerts if the values aren't yet available, to save the developer writing boilerplate code:
if(UI.selection) { // do something with the selection, or have an alert issued if not available }
API
UI.dom
Get the current Document DOM, or issue a standard warning if not available
The following example checks for a current document (and issues a warning if there is none) before executing the following code:
if(UI.dom) { // do something with the Document, or have an alert issued if not available }
UI.timeline
Get the current Timeline, or issue a standard warning if not available
The following example checks for a current timeline (and issues a warning if there is none) before executing the following code:
if(UI.timeline) { // do something with the Timeline, or have an alert issued if not available }
UI.items
Get the currently selected library items, or issue a standard warning if not selected
The following example checks there are library items (and issues a warning if there are none) before executing the following code:
if(UI.items) { // do something with the Library items, or have an alert issued if not available }
UI.selection
Get the current selection, or issue a standard warning if nothing is selected
The following example checks for a selection (and issues a warning if there is none) before executing the following code:
if(UI.selection) { // do something with the selection, or have an alert issued if not available }
state
Lightweight function to return the current UI state as an object
The following example returns an Object that represents the current state of the document:
inspect(UI.state);
object => Object document: "file:///E|/xJSFL/modules/Code%20Examples/assets/fla/example%20assets.fla" timeline: "random shapes" layers: "7,4,5,6" frames: "4,0,1,5,0,1,6,0,1,7,0,1" numLayers: 17 numFrames: 1 selection: null
Comments are closed.