all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

Targeting Text Fields for XML


Targeting Text Fields for XML sw33t
9/21/2005 10:20:05 PM
flash actionscript:
I have a working function that I placed on a screen. Both text areas are
located on the same screen.

If I move the text areas to a child screen, of course it breaks. How does one
target screens with XML?

For example, I have name_txt and comment_txt on the "presentation" screen. As
the presentation moves to screen "john," can I place a script on the "john"
screen to change the values of my text fields on the "presentation" screen? Or
do I have to create new text fields per screen?

Thanks so much in advance.



function loadXML(loaded) {
if (loaded) {
inventor =
this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
comments =
this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
name_txt.text = inventor;
comment_txt.text = comments;
} else {
content = "file not loaded!";
}
}
Re: Targeting Text Fields for XML sw33t
9/22/2005 6:23:31 PM
Ok perhaps I can post my code and *someone* can help me out here.

scenario:
I have a presentation slide with two text boxes, comment_txt and name_txt. For
each child slide, I'd like to load XML into those main text boxes. I'm having a
set of bullet points for each slide, called from an XML file for easy updates.
Does that make sense?

on my top/main/presentation slide:
onClipEvent (load) {
function loadXML(loaded) {
if (loaded) {
var1 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
var2 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
var3 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
var4 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
var5 = "i am being called from var5";
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("myxml.xml");
}

on the first child slide:
onClipEvent (load) {
this._parent.comment_txt.text = "hello world";
this._parent.name_txt.text = var1;
}

results:
For the first child slide, comment_txt loads, but name_txt does not. I have
confirmed that the XML file is properly loading, it's just not sticking the
variable in the text box. I'm assuming it's a targeting issue. Any thoughts?
AddThis Social Bookmark Button