Very BASIC XML video problem! Help?

  • Head In A Pan
  • Newbie
  • Newbie
  • User avatar
  • Posts: 13
  • Loc: Sydney

Post 3+ Months Ago

OK...

This is so basic but I just can't get XML to talk to Flash for me. ;(
I want Flash to grab the one & only elements from XML, load it into my player (which works) & play it automatically.

Anything obvious? I'm confused.

Here's my AS
Code: [ Select ]
var vList:XML = new XML();
vList.ignoreWhite = true;
vList.load('oneVideo.xml');

vList.onLoad = function(){  
ns.play(0);

};
  1. var vList:XML = new XML();
  2. vList.ignoreWhite = true;
  3. vList.load('oneVideo.xml');
  4. vList.onLoad = function(){  
  5. ns.play(0);
  6. };


XML
Code: [ Select ]
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos
theVideo="videos/1.flv"/>

</videos>
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <videos
  3. theVideo="videos/1.flv"/>
  4. </videos>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

try this

Code: [ Select ]
trace(vList);


just check ur xml file
  • Head In A Pan
  • Newbie
  • Newbie
  • User avatar
  • Posts: 13
  • Loc: Sydney

Post 3+ Months Ago

It outputs the following

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>



- which is weird as it did this before when I was testing a very basic XML example that was supposed to read a text sentence -

What's going on?
  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

that wrong output something rong with ur xml

try this xml file

Code: [ Select ]
 <?xml version="1.0" encoding="ISO-8859-1" ?>
<videos>
 <vid theVideo="videos/1.flv" />
</videos>
  1.  <?xml version="1.0" encoding="ISO-8859-1" ?>
  2. <videos>
  3.  <vid theVideo="videos/1.flv" />
  4. </videos>
  • Head In A Pan
  • Newbie
  • Newbie
  • User avatar
  • Posts: 13
  • Loc: Sydney

Post 3+ Months Ago

Tried it - still the same result -
I was thinking that it's at least reading the XML - which is a start. ;-/

But I'm lost now.
I can get XML to read mp3, text & jpgs etc - but video is another world...
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

You have two problems. Your not waiting for your xml to load (its not instantaneous) and then your not parsing the xml

When you load the xml you want to put it into an array so that you can access it later.

Code: [ Select ]
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
    if (success) {
        _root.myXMLData = my_xml.firstChild.childNodes;
        someFunction();
        
    } else {
        trace("Problems loading xml");
    }
};

my_xml.load("some.xml");
  1. var my_xml = new XML();
  2. my_xml.ignoreWhite = true;
  3. my_xml.onLoad = function(success) {
  4.     if (success) {
  5.         _root.myXMLData = my_xml.firstChild.childNodes;
  6.         someFunction();
  7.         
  8.     } else {
  9.         trace("Problems loading xml");
  10.     }
  11. };
  12. my_xml.load("some.xml");


_root.myXMLData = my_xml.firstChild.childNodes; says to make an array with the xml data inside of the <XML></XML> container

The somefunction() is called to deal with the array data to build a menu, etc. Its usually nice to put that call inside the onload so that you don't try to access the array before the data has been loaded.

Kirupa has a very good XML Tutorial

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.