coldfusion.air

# SyncManager - AS3 CF

Package | coldfusion.air
Class | public class SyncManager
Inheritance | SyncManager Object
Implements | IEventDispatcher

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

This is the main class that connects to the ColdFusion server to fetch and synchronize offline data with the server.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | autoCommit : Boolean = false If autoCommit is set to true, then the changes from the offline database will be commited to the server after save/update/saveUpdate or remove function is invoked. | SyncManager
|  | cfContextRoot : String Context root of the ColdFusion server. | SyncManager
|  | cfPort : int Port where the ColdFusion server is running. | SyncManager
|  | cfServer : String Name or IP address of the ColdFusion server. | SyncManager
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | destination : String Specifies the destination for the remoting call. | SyncManager
|  | secureHttp : Boolean Boolean value that specifies if secure HTTP is used: yes: uses secure HTTP no: does not use secure HTTP | SyncManager
|  | syncCFC : String Fully qualified CFC name that implements the CFIDE.AIR.ISyncManager interface. | SyncManager

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | SyncManager() Creates an instance of the SyncManager class. | SyncManager
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | SyncManager
|  | dispatchEvent(evt:Event):Boolean Dispatches an event into the event flow. | SyncManager
|  | fetch(fetchMethod:String, ... args):mx.rpc:AsyncToken Fetches the data from the server. | SyncManager
|  | getCurrentSession():Session Returns the Session instance that is currently open. | SyncManager
|  | getRemoteObject():RemoteObject Returns the RemoteObject instance used by the offline library to make the remote object call. | SyncManager
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | SyncManager
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | openSession(dbfile:File, id:uint, encryptionKey:ByteArray = null, cacheDirectory:File = null):coldfusion.air:SessionToken Creates a session with a specific database file. | SyncManager
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | SyncManager
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | SyncManager

Events
Click for more information on events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | fault | Dispatched when a session service call fails. | SyncManager
|  | result | Dispatched when a syncmanager call returns successfully. | SyncManager

Property Detail

### autoCommit

property

`public var autoCommit:Boolean = false`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

If autoCommit is set to true, then the changes from the offline database will be commited to the server after save/update/saveUpdate or remove function is invoked. Effectively, it would be equivalent to calling session.commit() function after the save/update/saveUpdate/remove functions are executed.

### cfContextRoot

property

`public var cfContextRoot:String`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Context root of the ColdFusion server.

### cfPort

property

`public var cfPort:int`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Port where the ColdFusion server is running.

### cfServer

property

`public var cfServer:String`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Name or IP address of the ColdFusion server.

### destination

property

`public var destination:String`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Specifies the destination for the remoting call.

### secureHttp

property

`public var secureHttp:Boolean`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Boolean value that specifies if secure HTTP is used:

- `yes`: uses secure HTTP
- `no`: does not use secure HTTP

### syncCFC

property

`public var syncCFC:String`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Fully qualified CFC name that implements the `CFIDE.AIR.ISyncManager` interface.

Constructor Detail

### SyncManager

()
Constructor

`public function SyncManager()`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Creates an instance of the SyncManager class.

Method Detail

### addEventListener

()
method

`public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.

Parameters

| `type:String` — The type of event.
| `listener:Function` — The listener function that processes the event.
| `useCapture:Boolean` (default = `false`)`` — Determines whether the listener works in the capture phase or the target and bubbling phases:

- If `useCapture` is set to `true`, the listener processes the event only during the capture phase and not in the target or bubbling phase.
- If `useCapture` is `false`, the listener processes the event only during the target or bubbling phase.

| `priority:int` (default = `0`)`` — The priority level of the event listener. The priority is designated by a signed 32-bit integer.
| `useWeakReference:Boolean` (default = `false`)`` — Determines whether the reference to the listener is strong or weak.

### dispatchEvent

()
method

`public function dispatchEvent(evt:Event):Boolean`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Dispatches an event into the event flow.

Parameters

| `evt:Event` — The Event object that is dispatched into the event flow. If the event is being redispatched, a clone of the event is created automatically.

Returns

| `Boolean` — A value of true if the event was successfully dispatched. A value of false indicates failure or that preventDefault() was called on the event.

### fetch

()
method

`public function fetch(fetchMethod:String, ... args):mx.rpc:AsyncToken`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Fetches the data from the server.

Parameters

| `fetchMethod:String` — The name of the fetch method to be executed on the server.
| `... args` — The arguments for `fetchMethod`

Returns

| `mx.rpc:AsyncToken` — An AsyncToken with which call backs can be registered.

### getCurrentSession

()
method

`public function getCurrentSession():Session`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Returns the Session instance that is currently open.

Returns

| `Session`

### getRemoteObject

()
method

`public function getRemoteObject():RemoteObject`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Returns the `RemoteObject` instance used by the offline library to make the remote object call.

Returns

| `RemoteObject`

### hasEventListener

()
method

`public function hasEventListener(type:String):Boolean`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy. To determine whether a specific event type actually triggers an event listener, use `willTrigger()`.

Parameters

| `type:String` — The type of event.

Returns

| `Boolean` — A value of true if a listener of the specified type is registered; false otherwise.

### openSession

()
method

`public function openSession(dbfile:File, id:uint, encryptionKey:ByteArray = null, cacheDirectory:File = null):coldfusion.air:SessionToken`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9.0.1

Runtime Versions: | Flash Player 9, AIR 1.0

Creates a session with a specific database file.

Parameters

| `dbfile:File` — The File reference associated with the database file
| `id:uint` — Unique session ID per session
| `encryptionKey:ByteArray` (default = `null`)`` — Optional key to encrypt the database files
| `cacheDirectory:File` (default = `null`)`` — Optional directory where the cache database file, used internally by the framework, is stored. By default, the cache file is stored in the flash.filesystem.File.applicationStorageDirectory.

Returns

| `coldfusion.air:SessionToken` — The session token associated with the call

### removeEventListener

()
method

`public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Removes a listener from the EventDispatcher object.

Parameters

| `type:String` — The type of event.
| `listener:Function` — The listener object to remove.
| `useCapture:Boolean` (default = `false`)`` — Specifies whether the listener was registered for the capture phase or the target and bubbling phases.

### willTrigger

()
method

`public function willTrigger(type:String):Boolean`

Language Version: | ActionScript 3.0

Product Version: | ColdFusion 9

Runtime Versions: | Flash Player 9, AIR 1.0

Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.

Parameters

| `type:String` — The type of event.

Returns

| `Boolean` — A value of true if a listener of the specified type will be triggered; false otherwise.

Event Detail

### fault

Event

Event Object Type: `coldfusion.air.events.SyncFaultEvent`
property SyncFaultEvent.type = `coldfusion.air.events.SyncFaultEvent.FAULT`

Dispatched when a session service call fails.

The type of the event.

### result

Event

Event Object Type: `coldfusion.air.events.SyncResultEvent`
property SyncResultEvent.type = `coldfusion.air.events.SyncResultEvent.RESULT`

Dispatched when a syncmanager call returns successfully.

The type of the event.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00