# Create bindings with ActionScript

**URL:** <https://forum.kirupa.com/t/create-bindings-with-actionscript/190050>\
**Category:** flash\
**Created:** [June 8, 2006, 7:59am UTC](https://forum.kirupa.com/t/create-bindings-with-actionscript/190050 "2006-06-08T07:59:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FredrikGeers](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@FredrikGeers](https://forum.kirupa.com/u/FredrikGeers)\
**Post date:** [June 8, 2006, 7:59am UTC](https://forum.kirupa.com/t/create-bindings-with-actionscript/190050/1 "2006-06-08T07:59:33Z")

</div>

I want to make an application, that creates a XMLConnector, DataSet and DataGrid at runtime, and sets the right bindings so the xml data is displayed in the DataGrid.  
I’ve tried this, but I can’t get it to work.

The steps I take if I create the bindings with the Flash IDE are:

- Drag XMLConnector, DataSet and DataGrid to stage and give it an instance names
- Select XMLConnector and load XML file in Schema tab
- Select DataSet and create binding with XMLConnector
- Select DataSet and create binding with DataGrid
- Use the trigger() method of XMLConnector

This works so far. But now doing this at runtime.

Creating the instances isn’t a problem. But I can’t find how to load the XML file in the Schema tab using ActionScript only. And I’m also not sure how to create the bindings. In the bindings examples I’ve read I see an event property, but I don’t have an event property when doing this in the Flash IDE.

Because of my trouble with this, I created all the components and also imported the XML file in the Schema tab, and wanted to only create the bindings using actionscript, but that still doesn’t work.

My code:

```auto
var src1:EndPoint = new EndPoint();
src1.component = xmlConProducten;
src1.property = "results.products.product";
var dest1:EndPoint = new EndPoint();
dest1.component = dsProducten;
dest1.property = "dataProvider";
var bndXmlDs:Binding = new Binding(src1, dest1);

var src2:EndPoint = new EndPoint();
src2.component = dsProducten;
src2.property = "dataProvider";
var dest2:EndPoint = new EndPoint();
dest2.component = dgProducten;
dest2.property = "dataProvider";
var bndDsDg:Binding = new Binding(src2, dest2);

bndXmlDs.execute(false);
bndDsDg.execute(false); 

```

My questions are:  
Is it possible?  
How do I create those bindings?  
What is the AS equivalent of loading the XML file in the Schema tab?
