EndPoint class

ActionScript Class Name mx.data.binding.EndPoint

The EndPoint class defines the source or destination of a binding. EndPoint objects define a constant value, component property, or particular field of a component property, from which you can get data, or to which you can assign data. They can also define an event, or list of events, that a Binding object listens for; when the specified event occurs, the binding executes. To make this class available at runtime, you must include the data binding classes in your FLA file. For more information, see Making data binding classes available at runtime.

NOTE

 

The EndPoint class is supported only if you are working in a document that specifies ActionScript 2.0 in its Publish Settings.

When you create a new binding with the Binding class constructor, you pass it two EndPoint objects: one for the source and one for the destination.

new mx.data.binding.Binding(srcEndPoint, destEndPoint);

The EndPoint objects, srcEndPoint and destEndPoint, might be defined as follows:

var srcEndPoint = new mx.data.binding.EndPoint();
var destEndPoint = new mx.data.binding.EndPoint();
srcEndPoint.component = source_txt;
srcEndPoint.property = "text";
srcEndPoint.event = "focusOut";
destEndPoint.component = dest_txt;
destEndPoint.property = "text";

In English, the above code means "When the source text field loses focus, copy the value of its text property into the text property of the destination text field."

You can also pass generic ActionScript objects to the Binding constructor, rather than passing explicitly constructed EndPoint objects. The only requirement is that the objects define the required EndPoint properties, component and property. The following code is equivalent to that shown above.

var srcEndPoint = {component:source_txt, property:"text"};
var destEndPoint = {component:dest_txt, property:"text"};
new mx.data.binding.Binding(srcEndPoint, destEndPoint); 

For an overview of the classes in the mx.data.binding package, see Classes in the mx.data.binding package.

Property summary for the EndPoint class

The following table lists the properties of the EndPoint class.

Method

Description

EndPoint.component

A reference to a component instance.

EndPoint.constant

A constant value.

EndPoint.event

The name of an event, or array of event names, that the component emits when the data changes.

EndPoint.location

The location of a data field within the property of the component instance.

EndPoint.property

The name of a property of the component instance specified by EndPoint.component.


Flash CS3