Hi there, can anyone help me to get this work? I have an XMLConnector (myXMLConnector) and a dataSet (myDataSet_ds). I can’t get the data from the XMLConnector into myDataSet_ds, when I bind it at runtime? Nothing appears… if I bind it visually using the component inspector it works, but I need to be able to control it via actionscript. Thanks for any help, I am completely stuck!! Cheers, Matt.
XML SOURCE
[PHP]
<?xml version=“1.0” encoding=“UTF-8”?>
<trips>
<trip name=“Napa Valley”>
<description>The incredible variety of Napa Valley…</description>
<cost>1095</cost>
<tapes>2</tapes>
<image>images/napa.jpg</image>
</trip>
<trip name=“Big Sur”>
<description>From beaches to mountains…</description>
<cost>1395</cost>
<tapes>2</tapes>
<image>images/bigsur.jpg</image>
</trip>
<trip name=“Grand Canyon”>
<description>Located entirely in northern Arizona…</description>
<cost>1111</cost>
<tapes>1</tapes>
<image>images/grandcanyon.jpg</image>
</trip>
</trips>
[/PHP]
FLASH SOURCE
[AS]
import mx.data.binding.*;
myXMLConnector.URL = “data/trips2.xml”;
myXMLConnector.trigger();
var myResult = function (ev) {
dataBind();
};
myXMLConnector.addEventListener(“result”, myResult);
function dataBind() {
var srcEndPoint = new mx.data.binding.EndPoint();
var destEndPoint = new mx.data.binding.EndPoint();
// source
srcEndPoint.component = myXMLConnector;
srcEndPoint.property = “results”;
srcEndPoint.event = “result”;
srcEndPoint.location = “/trips/trip”;
// destination
destEndPoint.component = myDataSet_ds;
destEndPoint.property = “dataProvider”;
// create new binding
var myBinding:Binding = new Binding(srcEndPoint, destEndPoint);
myBinding.execute();
};
[/AS]
Did you find a solution matt?
I am having great difficulty trying to get Datagrid to refresh to bound xml connector during runtime also. Not much info at MM or elsewhere on net for this issue.
I have set up listener on the bound xml connector which broadcasts when connector receives new data from URL + trigger, but still unsuccessful in updating bound components.
Have also tried Binding.execute() without any success.
Anyone have any ideas? Any help will be much appreciated.
- 19 February 2004 01:21 AM
-
Author
No real luck yet! But, my location was not quite right and should have been:
srcEndPoint.location = “trips/trip”;
This at least gets the data into the DataSet, but it goes in as a string (XML) rather than as an array. So I can’t access the dataSet. It’s frustrating enough to make me want to change jobs, right now…
I cannot find anything anywhere to help. The MM help files are all very well, but they don’t take you through a proper and useful example from start to finish, if you want to script it.
I think I need to apply a custom formatter of some sort, but try following the help files to make it work! Impossible…
Matt
- 19 February 2004 06:21 AM
-
Hi Again Matt,
I have resolved my problem and may be able to help you out.
In my situation I have used the component inspector to bind components. Then change the URL address (actually add var to php call) and trigger the xml connector. It all updates automatically.
As you are binding your components with actionscript only you may need to use the ComponentMixins class which will enable you to use the refreshDestinations or refreshFromSources methods which update all bindings from a source or to a destination. You may need to include the DataBindingClasses SWC from your Classes Library into your .fla Library if not present to enable the class code to compile.
Hope this helps.
- 19 February 2004 10:04 AM
-
Author
Hello chap,
You wouldn’t believe it, but that’s exactly what I was just working on! Exactly the very same thing - visually bind the DataSet to the XMLConnector, because as you say, we both know it works. Then change the URL to the Connector…
I haven’t fully tested this yet, but I think it’s probably the way to go - the more I think about it the more I like it.
The DataSet can sit on _level0 with all my script and everything that needs to can be bound to from anywhere else. I just need to make sure that I can get to the right data from myXML within the DataSet.
Let me know how you get on with this - you’re dataGrid should be pretty good now? I’m going to work on this method over the next few days to test a few scenarios, and I’ll let you know how it goes on this thread.
Nice work fella… it’s good to have some feedback from someone! ;-)
- 19 February 2004 11:59 AM
-
- Log in or join for free to make a comment.


