[Flashcoders] Problems with XML

2005-12-16 Thread Jose Maria Barros
Im having some problems loading an XML file into flash. The client
inserts in the databse some elements and then an ASP page creates the
xml file and flash reads it.

The problem is that sometimes the flash tells me undefined

i go to the database and the data is there..but in xml file it isnt.

There are some other sections of the website that uses the same
method, and its working good...

here have too URLs(one empty and other with info)

http://www.celeiro-dieta.pt/ementa2.xml
http://www.celeiro-dieta.pt/ementa.xml

Here is the code that i use in flash:

//XML


ementa_xml = new XML();
_root.myEmenta = new Array();
ementa_xml.load(ementa2.xml);
ementa_xml.onLoad = startEmenta;
ementa_xml.ignoreWhite = true;
_root.main11.ementa_txt = ;


function startEmenta(success_ementa) {

if (success_ementa == true) {
rootNode_ementa = ementa_xml.firstChild;
totalEmenta = rootNode_ementa.childNodes.length;
firstEmenta = rootNode_ementa.firstChild;
currentEmenta = firstEmenta;
tituloEmenta = currentEmenta.attributes.titulo_ementa;
currentIndex_ementa = 1;
dia_ementa = parseInt(currentEmenta.attributes.Dia,10);
dia_txt.text = dias[dia_ementa];
_root.main11.ementa_txt = _root.main11.ementa_txt+font
color='#328828' size='12'b+tituloEmenta+/b/fontbr;

for (a=1; a=totalEmenta; a++) {
if (tituloEmenta != undefined) {
if ((tituloEmenta) == 
(currentEmenta.attributes.titulo_ementa)) {
_root.main11.ementa_txt =
_root.main11.ementa_txt+currentEmenta.attributes.texto_ementa+br;
} else {
tituloEmenta = 
currentEmenta.attributes.titulo_ementa;
_root.main11.ementa_txt = 
_root.main11.ementa_txt+font
color='#328828'
size='12'b+currentEmenta.attributes.titulo_ementa+/b/fontbr+currentEmenta.attributes.texto_ementa+br;
}
}
currentEmenta = currentEmenta.nextSibling;
_root.main11.caixa._height += 100;
}
}
}
///XML END
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problems with XML

2005-12-16 Thread Roman Blöth

Jose Maria Barros schrieb:

Im having some problems loading an XML file into flash. The client
inserts in the databse some elements and then an ASP page creates the
xml file and flash reads it.

[..]

Here is the code that i use in flash:

//XML


ementa_xml = new XML();
_root.myEmenta = new Array();
ementa_xml.load(ementa2.xml);
ementa_xml.onLoad = startEmenta;
ementa_xml.ignoreWhite = true;
_root.main11.ementa_txt = ;
Here is a problem: You define the XML.onLoad-action AFTER loading the 
XML. In any way you must define


ementa_xml.onLoad = startEmenta;

before you call

ementa_xml.load(ementa2.xml);



Regards,
Roman.
--

---
 gosub communications gmbh | fredersdorfer str. 10  | 10243 berlin
 t [030] 29 66 88 81 | f [030] 29 66 88 84 | http://www.gosub.de
---
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problems with XML

2005-12-16 Thread Jose Maria Barros
Well...ive changed that to test..but i put like you said again...and
the problem still persists.

On 12/16/05, Roman Blöth [EMAIL PROTECTED] wrote:
 Jose Maria Barros schrieb:
  Im having some problems loading an XML file into flash. The client
  inserts in the databse some elements and then an ASP page creates the
  xml file and flash reads it.
 [..]
  Here is the code that i use in flash:
 
  //XML
 
 
  ementa_xml = new XML();
  _root.myEmenta = new Array();
  ementa_xml.load(ementa2.xml);
  ementa_xml.onLoad = startEmenta;
  ementa_xml.ignoreWhite = true;
  _root.main11.ementa_txt = ;
 Here is a problem: You define the XML.onLoad-action AFTER loading the
 XML. In any way you must define

 ementa_xml.onLoad = startEmenta;

 before you call

 ementa_xml.load(ementa2.xml);



 Regards,
 Roman.
 --

 ---
   gosub communications gmbh | fredersdorfer str. 10  | 10243 berlin
   t [030] 29 66 88 81 | f [030] 29 66 88 84 | http://www.gosub.de
 ---
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problems with XML

2005-12-16 Thread Apostolos Manolitzas
  [..]
   Here is the code that i use in flash:
  
   //XML
  
  
   ementa_xml = new XML();
   _root.myEmenta = new Array();
   ementa_xml.load(ementa2.xml);
   ementa_xml.onLoad = startEmenta;
   ementa_xml.ignoreWhite = true;
   _root.main11.ementa_txt = ;
  Here is a problem: You define the XML.onLoad-action AFTER loading the
  XML. In any way you must define
 
  ementa_xml.onLoad = startEmenta;
 
  before you call
 
  ementa_xml.load(ementa2.xml);
 
 

Hi,

try using an example like this:

// taken from: http://www.kirupa.com/web/xml/XMLspecificIssues3.htm
import mx.utils.Delegate;
class foo {
  var xmlData:XML;
function loadXML(_xmlurl:String) {
xmlData = new XML();
var classRef:Object = this;
xmlData.ignoreWhite = true;
xmlData.onLoad = Delegate.create(this, parseXML);
xmlData.load(_xmlurl);
}
function parseXML() {
trace(xmlData.toString());
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problems with XML

2005-12-16 Thread Jose Maria Barros
Thanks for the help Apostolos.

But the problem is somewhere in the asp page...



On 12/16/05, Apostolos Manolitzas [EMAIL PROTECTED] wrote:
   [..]
Here is the code that i use in flash:
   
//XML
   
   
ementa_xml = new XML();
_root.myEmenta = new Array();
ementa_xml.load(ementa2.xml);
ementa_xml.onLoad = startEmenta;
ementa_xml.ignoreWhite = true;
_root.main11.ementa_txt = ;
   Here is a problem: You define the XML.onLoad-action AFTER loading the
   XML. In any way you must define
  
   ementa_xml.onLoad = startEmenta;
  
   before you call
  
   ementa_xml.load(ementa2.xml);
  
  

 Hi,

 try using an example like this:

 // taken from: http://www.kirupa.com/web/xml/XMLspecificIssues3.htm
 import mx.utils.Delegate;
 class foo {
   var xmlData:XML;
 function loadXML(_xmlurl:String) {
 xmlData = new XML();
 var classRef:Object = this;
 xmlData.ignoreWhite = true;
 xmlData.onLoad = Delegate.create(this, parseXML);
 xmlData.load(_xmlurl);
 }
 function parseXML() {
 trace(xmlData.toString());
 }
 }
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders