Groups | Blog | Home
all groups > flash actionscript > april 2006 >

flash actionscript : Internal XML problems AS2.0


halcyon32
4/23/2006 6:57:08 PM
Hi all
I could use a little help internalizing an XML file... I have found some
examples of how to do this but they all seem to be for AS1.0 and they don't
work in AS2.0 or at least not in my AS2.0 :D

So I have started here with your typical loading of an external XML file.

I hope this makes sense... If not let me know and I will try to clear it up...

Thanks in advance
Scott

[CODE]
/***** LOAD XML ****/
var timeLineXMLConn:XML = new XML ();
this.timeLineXMLConn.ignoreWhite = true;
this.timeLineXMLConn.load ("02.xml");
this.timeLineXMLConn.trigger ();
trace ("this is = " + this);
this.timeLineXMLConn.onLoad = function (success:Boolean):Void {
if (success) {
//trace("this is Loaded = "+this);
eval ("entry_clip" + i).entry_text.text = timeLineXMLConn;
this.timelineXML.onload = processXML ();
} else {
trace ("error loading XML file");
}
};
[/CODE]

And here is where I have ended up:
[CODE]
[COLOR="Red"]var timeLineXMLConn:XML = new XML ("<?xml version="1.0"
encoding="iso-8859-1" ?><entry><timeline timeName="Name-2"
color="0x333366"><note><note_date day="1" month="1"
year="1997"/><note_headLine><![CDATA[head
1-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_position>400</note_position><note_height>430</note_he
ight></note><note><note_date day="2" month="1"
year="1999"/><note_headLine><![CDATA[head
1-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_position>420</note_position><note_height>460</note_heig
ht></note><note><note_date day="1" month="3"
year="1999"/><note_headLine><![CDATA[head
1-3]]></note_headLine><note_copy><![CDATA[Car accident in which young girl on
bicycle hit Mrs. Wheeler?s windshield Mrs. Wheeler sustained neck and back
injuries, but no psychological or emotional
problems.]]></note_copy><note_position>440</note_position><note_height>350</note
_height></note></timeline><timeline timeName="Name-3"
color="0x663366"><note><note_date day="2" month="1"
year="1997"/><note_headLine><![CDATA[head
2-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_position>600</note_position><note_height>570</note_he
ight></note><note><note_date day="2" month="2"
year="2000"/><note_headLine><![CDATA[head
2-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_position>620</note_position><note_height>460</note_heig
ht></note></timeline></entry>");[/COLOR]
//var timeLineXMLConn:XML = new XML ();
this.timeLineXMLConn.ignoreWhite = true;
//this.timeLineXMLConn.load ("02.xml");
this.timeLineXMLConn.trigger ();
trace ("this is = " + this);
this.timeLineXMLConn.onLoad = function (success:Boolean):Void {
if (success) {
//trace("this is Loaded = "+this);
eval ("entry_clip" + i).entry_text.text = timeLineXMLConn;
this.timelineXML.onload = processXML ();
} else {
trace ("error loading XML file");
}
};
[/CODE]


But this keeps giving me an error of:
[COLOR="Red"]**Error** Symbol=scrollClip, layer=Layer 1, frame=1:Line 54: ')'
or ',' expected[/COLOR]

So I have tried many different things to fix this such as:
[CODE]
var timeLineXMLConn:XML = new XML (<?xml version="1.0" encoding="iso-8859-1"

var timeLineXMLConn:XML = new XML ("<?xml version="1.0" encoding="iso-8859-1"

var timeLineXMLConn:XML = new XML ("'<?xml version="1.0" encoding="iso-8859-1"

var timeLineXMLConn:XML = new XML ('"<?xml version="1.0" encoding="iso-8859-1"

var timeLineXMLConn:XML = new XML ('/"<?xml version="1.0"
encoding="iso-8859-1"

var timeLineXMLConn:XML = new XML ("'/<?xml version="1.0"
encoding="iso-8859-1"
[/CODE]
Do I need to escape my XML or is it even possible to Load an internal XML file
in AS2.0?

I also have tried to put the XML into a separate variable and then calling
that variable from my var:
[CODE]
timeLineXMLConn:XML = new XML (myxml);
myxml = '<someXMLHere>';
[/CODE]
And:
[CODE]
timeLineXMLConn:XML = new XML (myxml);
myxml =('<someXMLHere>');
[/CODE]
blemmo
4/23/2006 9:07:49 PM
Hi,

there are various issues in that codes: the XML class has no trigger(), the
line
this.timelineXML.onload = processXML ()
is totally wrong (in the context of the posted code). But this shouldn't
affect the loading, so the problem should be
eval ("entry_clip" + i).entry_text.text = timeLineXMLConn;
eval() shouldn't be used this way, so better use dot or array syntax here:
_root.entry_clipX.entry_text.text
or
_root.entry_text.text
Make sure the path is right and that 'i' is defined. Also don't do
(...).text = timeLineXMLConn;
but rather
(...).text = timeLineXMLConn.toString().
This is the whole loading code:
--
var timeLineXMLConn:XML = new XML();
this.timeLineXMLConn.ignoreWhite = true;
this.timeLineXMLConn.load("02.xml");
trace("this is = "+this);
this.timeLineXMLConn.onLoad = function(success:Boolean):Void {
if (success) {
//trace("this is Loaded = "+this);
_root.entry_text.text = this.toString();
} else {
trace("error loading XML file");
}
};
--

For the xml creating: the parameter for the XML constructor is a string
surrounded by " ", but it contains also string signs ("), so you have to decide
which sort (simple ' or double ") defines which strings: if the xml string is
surrounded by " ", you can use ' ' inside it, or you use the other way around
(it doesn't matter which way you use, it just has to be clear). E.g.:
var xml = new XML ( "<?xml version='1.0' encoding='iso-8859-1' ?><root><entry
id='entry1' /></root>" );
To mask the signs, when you want to use the same sort inside the string as
surrounding, use a backslash before it, so it won't get interpreted as end of
the string:
var xml = new XML ( "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?> ..." );

But if you want to test your code using this string, you shouldn't call load()
after you created the xml, it will replace the just created content.

hth,
blemmo
halcyon32
4/23/2006 9:10:35 PM
Ok well I have traced the problem down to the

this.timeLineXMLConn.onLoad = function (success:Boolean):Void { }

When I trace ("timeLineXMLConn = " + timeLineXMLConn); out side of the onLoad
function it shows an output. But when I do the same trace ("timeLineXMLConn = "
+ timeLineXMLConn); inside of my timeLineXMLConn.onLoad = function I get
nothing....

I don't think this: this.timeLineXMLConn.onLoad = function
(success:Boolean):Void is getting called...
it might be something to do with the way the var timeLineXMLConn:XML = new XML
(); is being triggered this.timeLineXMLConn.trigger ();

Thanks
Scott


/***** LOAD XML ****/
var timeLineXMLConn:XML = new XML ("<?xml version=\"1.0\"
encoding=\"iso-8859-1\" ?><entry><timeline timeName=\"Name-2\"
color=\"0x333366\"><note><note_date day=\"1\" month=\"1\"
year=\"1997\"/><note_headLine><![CDATA[head
1-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_position>400</note_position><note_height>430</note_he
ight></note><note><note_date day=\"2\" month=\"1\"
year=\"1999\"/><note_headLine><![CDATA[head
1-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_position>420</note_position><note_height>460</note_heig
ht></note><note><note_date day=\"1\" month=\"3\"
year=\"1999\"/><note_headLine><![CDATA[head
1-3]]></note_headLine><note_copy><![CDATA[Car accident in which young girl on
bicycle hit Mrs. Wheeler?s windshield Mrs. Wheeler sustained neck and back
injuries, but no psychological or emotional
problems.]]></note_copy><note_position>440</note_position><note_height>350</note
_height></note></timeline><timeline timeName=\"Name-3\"
color=\"0x663366\"><note><note_date day=\"2\" month=\"1\"
year=\"1997\"/><note_headLine><![CDATA[head
2-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_position>600</note_position><note_height>570</note_he
ight></note><note><note_date day=\"2\" month=\"2\"
year=\"2000\"/><note_headLine><![CDATA[head
2-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_position>620</note_position><note_height>460</note_heig
ht></note></timeline></entry>");
this.timeLineXMLConn.ignoreWhite = true;
//this.timeLineXMLConn.load ("psychTreatmentTimeline02.xml");
this.timeLineXMLConn.trigger ();

trace ("timeLineXMLConn outside =>> " + timeLineXMLConn);
this.timeLineXMLConn.onLoad = function (success:Boolean):Void {
if (success) {
trace("this is Loaded = "+this);
trace ("timeLineXMLConn inside = " + timeLineXMLConn);
this.timelineXML.onload = processXML ();
} else {
trace ("error loading XML file");
}
};
blemmo
4/23/2006 9:20:03 PM
onLoad can't get called now, because you don't use XML.load(). Delete the
trigger action; the XML class has no trigger function. A call to XML.load()
starts loading, which triggers the onLoad event when it's finished. Inside
onLoad, you can use "this" to reference to the XML object:
trace("the xml = "+this);


halcyon32
4/23/2006 9:24:31 PM
Hi blemmo,
Thanks for the reply,

I'm posting the entire code... I'm no longer useing the eval ("entry_clip" +
i) chunk of code. Im now useing this.

I think this.timeLineXMLConn.onLoad = function (success:Boolean):Void is
not being called or the this.timeLineXMLConn.trigger (); is workingt right....

when I trace ("timeLineXMLConn = " + timeLineXMLConn); in side the onLoad
function() { I get nothing. But if I trace ("timeLineXMLConn = " +
timeLineXMLConn); outside the onLoad function() { I get my XML back....

Take a look...

Thanks
Scott





var timeLineXMLConn:XML = new XML ("<?xml version=\"1.0\"
encoding=\"iso-8859-1\" ?><entry><timeline timeName=\"Name-2\"
color=\"0x333366\"><note><note_date day=\"1\" month=\"1\"
year=\"1997\"/><note_headLine><![CDATA[head
1-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_position>400</note_position><note_height>430</note_he
ight></note><note><note_date day=\"2\" month=\"1\"
year=\"1999\"/><note_headLine><![CDATA[head
1-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_position>420</note_position><note_height>460</note_heig
ht></note><note><note_date day=\"1\" month=\"3\"
year=\"1999\"/><note_headLine><![CDATA[head
1-3]]></note_headLine><note_copy><![CDATA[Car accident in which young girl on
bicycle hit Mrs. Wheeler?s windshield Mrs. Wheeler sustained neck and back
injuries, but no psychological or emotional
problems.]]></note_copy><note_position>440</note_position><note_height>350</note
_height></note></timeline><timeline timeName=\"Name-3\"
color=\"0x663366\"><note><note_date day=\"2\" month=\"1\"
year=\"1997\"/><note_headLine><![CDATA[head
2-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_position>600</note_position><note_height>570</note_he
ight></note><note><note_date day=\"2\" month=\"2\"
year=\"2000\"/><note_headLine><![CDATA[head
2-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_position>620</note_position><note_height>460</note_heig
ht></note></timeline></entry>");
this.timeLineXMLConn.ignoreWhite = true;
this.timeLineXMLConn.trigger ();
this.timeLineXMLConn.onLoad = function (success:Boolean):Void {

if (success) {
trace("this is Loaded = "+this);
trace ("timeLineXMLConn = " + timeLineXMLConn);
this.timelineXML.onload = processXML ();
} else {
trace ("error loading XML file");
}
};
/***** LOAD XML ****/
//
//
//
//
/************* Process XML *****************/
function processXML () {
trace ("processXML = " + "Called");
// the y value of our entries,
// ie how far above the line they are
root_element = timeLineXMLConn.firstChild;
// loop through the XML
for (h = 0; h < root_element.childNodes.length; h++) {
trace ("--------- h = " + h + " -------- ");
element = root_element.childNodes[h];
trace ("element.childNodes[h] = " + element.childNodes[h]);
trace (root_element.childNodes[0].attributes["color"]);
processXMLchild ();
}
}
function processXMLchild () {
// pulling out the data as we go
for (i = 0; i < element.childNodes.length; i++) {
trace (" - - ");
trace ("i = " + i);
trace ("element.childNodes[" + i + "].nodeName = " +
element.childNodes[i].nodeName);
//lets grab our data
entry_color = root_element.childNodes[h].attributes["color"];
//entry_date =
root_element.childNodes[h].childNodes[i].firstChild.firstChild.nodeValue;
// date
entry_day =
root_element.childNodes[h].childNodes[i].firstChild.attributes["day"];
entry_month =
root_element.childNodes[h].childNodes[i].firstChild.attributes["month"];
entry_year =
root_element.childNodes[h].childNodes[i].firstChild.attributes["year"];
//
entry_headLine =
root_element.childNodes[h].childNodes[i].firstChild.nextSibling.firstChild.nodeV
alue;
entry_text =
root_element.childNodes[h].childNodes[i].firstChild.nextSibling.nextSibling.firs
tChild.nodeValue;
entry_ypos =
root_element.childNodes[h].childNodes[i].firstChild.nextSibling.nextSibling.next
Sibling.firstChild.nodeValue;
trace ("entry_pos = " + entry_pos);
trace ("day = " + entry_day + " month = " + entry_month + " year = " +
entry_year);
// Attach the clip and insert my data
attachXMLNodes ();
}
}
function attachXMLNodes () {
// Attach the clip and insert my data
var newPlot = attachMovie ("plot", "plot" + h + "" + i,
this.getNextHighestDepth ());
// assign the values...
this["plot" + h + "" + i].entry_clip.entry_text = entry_text;
this["plot" + h + "" + i].entry_clip.entry_date = entry_month + "/" +
entry_day + "/" + entry_year;
// finally set the position
placeMent ();
this["plot" + h + "" + i]._y = 685;
//Color the plot clip
this["plot" + h + "" + i].entry_clip.textBoxBack._alpha = Number (0);
this["plot" + h + "" + i].entry_clip.flagPoll._alpha = Number (0);
colorChange (this["plot" + h + "" + i].entry_clip.textBoxBack.entryBack);
colorChange (this["plot" + h + "" + i].plotBox);
colorChange (this["plot" + h + "" + i].entry_clip.flagPoll);
// move the plot to its new location

new mx.transitions.Tween (this["plot" + h + "" + i].entry_clip, "_y",
easeType, this["plot" + h + "" + i].entry_clip._y, -entry_ypos, time, true);
new mx.transitions.Tween (this["plot" + h + "" + i].entry_clip.flagPoll,
"_height", easeType, this["plot" + h + "" + i].entry_clip.flagPoll._height,
entry_ypos, time, true);
new mx.transitions.Tween (this["plot" + h + "" + i].entry_clip.flagPoll,
"_alpha", easeType, this["plot" + h + "" + i].entry_clip.flagPoll._alpha,
Number (20), time, true);
new mx.transitions.Tween (this["plot" + h + "" + i].entry_clip.textBoxBack,
"_alpha", easeType, this["plot" + h + "" + i].entry_clip.textBoxBack._alpha,
Number (100), time, true);
}
//************ Color function ***************//
function colorChange (who) {
var tf:Transform = new Transform (who);
var color_tf:ColorTransform = new ColorTransform ();
//Call the color from the XML
color_tf.rgb = entry_color;
//trace("0x" + color_tf.rgb.toString(16)); // 0xff0000
tf.colorTransform = color_tf;
}
//************ Clip PlaceMent function ***************//
function placeMent () {
var numberOfYears = Number (entry_year) - Number (yearArray[0]);
var pixelTotalForYears = numberOfYears * 372;
var pixelTotalForMonths = 31 * (Number (entry_month) - 1);
var pixelTotalForDays = Number (entry_day);
var totalPixelsPlaced = pixelTotalForYears + pixelTotalForMonths +
pixelTotalForDays;
var place = Number (totalPixelsPlaced);
blemmo
4/23/2006 9:58:20 PM
Please read more carefully, I now write it for the 3rd time: there is no
XML.trigger() function. Calling this won't do anything. Hit F1 inside Flash and
look up the XML class and its methods, you won't find "trigger()". While you're
there, check the entry for XML.load().

If you want to call "processXML" when the loading finished successfully, just
call it inside onLoad:
this.timeLineXMLConn.onLoad = function (success:Boolean):Void {
if (success) {
trace("this is Loaded = "+this);
trace ("timeLineXMLConn = " + timeLineXMLConn);
processXML ();
} else {
trace ("error loading XML file");
}
};

onLoad can only be executed when load() was called. To test processXML with
the xml string created in Flash, just call processXML() after the XML object
was created (and don't call load() in between).
halcyon32
4/23/2006 10:40:33 PM
Ok.... So All I need to do is:

var timeLineXMLConn:XML = new XML ("<XML HERE>");
this.timeLineXMLConn.ignoreWhite = true;
processXML ();

Or am I a complete dumb @!#$ :)

by the way if I haven't said it yet. thanks for taking the time to explain
this to me...
S


var timeLineXMLConn:XML = new XML ("<?xml version='1.0' encoding='iso-8859-1'
?><entry><timeline timeName='Name-1' color='0x336633'><note><note_date day='25'
month='4' year='2002'/><note_headLine><![CDATA[Subhash Deshmukh, MD, Primary
Care Examination Note]]></note_headLine><note_copy><![CDATA[<u>Current
Complaints</u>: Unable to sleep, crying all the time, and finds it ?hard to
believe what she witnessed and experienced yesterday.?<u>Diagnosis</u>: 1)
Situational anxiety and stress.<u>Plan</u>: Cut down narcotics. Take Motrin 3
times per day. Take Xanax. 4) Return in 5
days.]]></note_copy><note_height>570</note_height></note><note><note_date
day='29' month='4' year='2002'/><note_headLine><![CDATA[Judy Albert, MFT,
Psychological Evaluation Note]]></note_headLine><note_copy><![CDATA[<u>Current
Complaints</u>: Replays everything from accident, including smells, which
sometimes wakens her. Awakens crying,2-3 times per night. <u>Current
Medication</u>: Motrin and Xanax. <u>Intervention</u>: Explained \"butterfly
hug\" and EMDR (eye movement desensitization and
reprocessing).]]></note_copy><note_height>460</note_height></note><note><note_da
te day='5' month='2' year='2002'/><note_headLine><![CDATA[Vinayak Shanbhag, MD,
Initial Psychiatric Evaluation Note &
Tests]]></note_headLine><note_copy><![CDATA[<u>Current Complaints</u>:
Flashbacks. Nervousness, sadness, rapid heart rate, upset/churning stomach.
Poor sleep, with initial insomnia, frequent interruptions,
nightmares.<u>Current Medication</u>: Motrin, Flexeril, and
Xanax.<u>Diagnosis</u>: Post-traumatic Stress Disorder (PTSD),
acute.<u>Plan</u>: 1) Do breathing/relaxation exercises. 2) Contact Dr.
Deshmukh, Linda Winston, and Judy Albert. 3) Take Paxil. 4) Return in 2
weeks. 5) Extend medical leave until 05/07/02.]]></note_copy>
<note_height>350</note_height></note><note><note_date day='2' month='5'
year='2002'/><note_headLine><![CDATA[Employment Development Department (EDD),
Patient- and Physician-Completed Disability
Form]]></note_headLine><note_copy><![CDATA[PER PATIENT:<u>Condition Preventing
Work</u>: Post-traumatic stress syndrome, related to train accident.<br
/><u>Limitations</u>: Disability prevents sitting, driving, reading, writing,
typing, and concentrating.PER VINAYAK SHANBHAG, MD:<u>Diagnosis</u>: PTSD,
acute.<u>Treatment Plan</u>: Medication and
counseling.]]></note_copy><note_height>240</note_height></note><note><note_date
day='28' month='5' year='2005'/><note_headLine><![CDATA[Employment Development
Department (EDD), Patient- and Physician-Completed Disability
Form]]></note_headLine><note_copy><![CDATA[PER PATIENT:<u>Condition Preventing
Work</u>: Post-traumatic stress syndrome, related to train accident.<br
/><u>Limitations</u>: Disability prevents sitting, driving, reading, writing,
typing, and concentrating.PER VINAYAK SHANBHAG, MD:<u>Diagnosis</u>: PTSD,
acute.<u>Treatment Plan</u>: Medication and
counseling.]]></note_copy><note_height>130</note_height></note></timeline><timel
ine timeName='Name-2' color='0x333366'><note><note_date day='1' month='1'
year='1997'/><note_headLine><![CDATA[head
1-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_height>430</note_height></note><note><note_date
day='2' month='1' year='1999'/><note_headLine><![CDATA[head
1-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_height>460</note_height></note><note><note_date
day='1' month='3' year='1999'/><note_headLine><![CDATA[head
1-3]]></note_headLine><note_copy><![CDATA[Car accident in which young girl on
bicycle hit Mrs. Wheeler?s windshield Mrs. Wheeler sustained neck and back
injuries, but no psychological or emotional
problems.]]></note_copy><note_height>350</note_height></note></timeline><timelin
e timeName='Name-3' color='0x663366'><note><note_date day='2' month='1'
year='1997'/><note_headLine><![CDATA[head
2-1]]></note_headLine><note_copy><![CDATA[Marriage of 15 years ended Had some
therapy due to poor sleep, sadness and
crying]]></note_copy><note_height>570</note_height></note><note><note_date
day='2' month='2' year='2000'/><note_headLine><![CDATA[head
2-2]]></note_headLine><note_copy><![CDATA[Mother, who lived next store to Mrs.
Wheeler,
died]]></note_copy><note_height>460</note_height></note></timeline></entry>");
this.timeLineXMLConn.ignoreWhite = true;
processXML ();
/***** LOAD XML ****/
//
//
//
//
/************* Process XML *****************/
function processXML () {
trace ("processXML = " + "Called");
// the y value of our entries,
// ie how far above the line they are
root_element = timeLineXMLConn.firstChild;
// loop through the XML
for (h = 0; h < root_element.childNodes.length; h++) {
trace ("--------- h = " + h + " -------- ");
element = root_element.childNodes[h];
trace ("element.childNodes[h] = " + element.childNodes[h]);
processXMLchild ();
}
}
function processXMLchild () {
// pulling out the data as we go
for (i = 0; i < element.childNodes.length; i++) {
trace (" - - ");
trace ("i = " + i);
trace ("element.childNodes[" + i + "].nodeName = " +
element.childNodes[i].nodeName);
//lets grab our data
entry_color = root_element.childNodes[h].attributes["color"];
//entry_date =
root_element.childNodes[h].childNodes[i].firstChild.firstChild.nodeValue;
// date
entry_day =
root_element.childNodes[h].childNodes[i].firstChild.attributes["day"];
entry_month =
root_element.childNodes[h].childNodes[i].firstChild.attributes["month"];
entry_year =
root_element.childNodes[h].childNodes[i].firstChild.attributes["year"];
//
entry_headLine =
root_element.childNodes[h].childNodes[i].firstChild.nextSibling.firstChild.nodeV
alue;
entry_text =
root_element.childNodes[h].childNodes[i].firstChild.nextSibling.nextSibling.firs
tChild.nodeValue;
entry_ypos =
root_element.childNodes[h].childNodes[i].firstChild.nextSibling.nextSibling.next
Sibling.firstChild.nodeValue;
trace ("entry_pos = " + entry_pos);
trace ("day = " + entry_day + " month = " + entry_month + " year = " +
entry_year);
// Attach the clip and insert my data
attachXMLNodes ();
}
}
function attachXMLNodes () {
// Attach the clip and insert my data
var newPlot = attachMovie ("plot", "plot" + h + "" + i,
this.getNextHighestDepth ());
// assign the values...
this["plot" + h + "" + i].entry_clip.entry_text = entry_text;
LuigiL
4/24/2006 12:00:00 AM
[quoted text, click to view]
blemmo
4/24/2006 12:08:51 AM
you're welcome, de nada.

yes, the 3 lines are all you need for testing processXML. Pay some attention
on the scope of 'this', it may be unclear where "var timeLineXMLConn" gets
attached to, it depends on where the code is placed and from which context it
is called. It's safer to not use it here, and just reference timeLineXMLConn
without it.
It's also safer to pass the xml reference into the process function, instead
of writing the reference into the function. That way the function is far more
flexible, just depending on the input.

var timeLineXMLConn:XML = new XML ("<XML HERE>");
timeLineXMLConn.ignoreWhite = true;
processXML (timeLineXMLConn);

/************* Process XML *****************/
function processXML ( xml:XML) {
trace ("processXML = " + "Called");
// the y value of our entries,
// ie how far above the line they are
root_element = xml.firstChild;
...

greets,
blemmo
halcyon32
4/24/2006 2:35:26 PM
Hey guys thanks,

I'll be sure to call my function as such:
processXML (timeLineXMLConn);

function processXML (xml:XML) { }

I also just learned I should look into using Xpath instead of XMLConnector
class. So i guess I will be doing some studying on Xpath...

Once again thanks for all your help..
Scott
AddThis Social Bookmark Button