The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • Components
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 Components

  • matt247 Author 
    • 1296 
    • 0 
    • 5 
    Runtime binding XMLConnector to DataSet
    matt247

    Last reply Feb 22 2004, 12:45 PM

    by matt247

    Posted: Feb 16 2004, 11:57 AM

    by matt247

     

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]

  5 REPLIES
 
quest4
1  
quest4

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
  •  
matt247 Author 
2  
matt247

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
  •  
quest4
3  
quest4

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
  •  
matt247 Author 
4  
matt247

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
  •  
matt247 Author 
5  
matt247

Hi quest4,

Do you know how to extract a complete XML file out of a DataSet object? I’m beginning to make some progress with all of the bindings, but I’d like to be able to export a complete XMl file rather than a deltapacket… any ideas?

Cheers,

Matt

  • 22 February 2004 12:45 PM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 19:25:24