Highlighted

trying to add xml parts to a method

Community Beginner ,
Jan 29, 2019

Copy link to clipboard

Copied

is there any way I can put c as variable which is part of the xml into the method variables

function fl_bbbbb(Arr:Array,txt:TextField):void{

var st:String

st = txt.text

XMLdoc.doc[mynumberdoc].c.appendChild(

<vars>{st}</vars>)

}

Views

114

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

trying to add xml parts to a method

Community Beginner ,
Jan 29, 2019

Copy link to clipboard

Copied

is there any way I can put c as variable which is part of the xml into the method variables

function fl_bbbbb(Arr:Array,txt:TextField):void{

var st:String

st = txt.text

XMLdoc.doc[mynumberdoc].c.appendChild(

<vars>{st}</vars>)

}

Views

115

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 29, 2019 0
Advocate ,
Jan 30, 2019

Copy link to clipboard

Copied

Hi olinh

Although currently there is a trend in the forum of replying to almost all questions, I fear that in your case you won't get any useful answers. Why: Your question/pretext "is there any way I can put c as variable which is part of the xml into the method variables" and the function fl_bbbbb are too fuzzy.

So you want to put c into the method variables.

And c is part of the xml.

Does XMLdoc mean that it is somewhere defined with all the bells and whistles like:

import flash.events.Event;

import flash.net.URLLoader;

import flash.net.URLRequest;

var XMLdoc:XML;

var loader:URLLoader = new URLLoader();

var request:URLRequest = new URLRequest("xmlFile.xml");

loader.load(request);

loader.addEventListener(Event.COMPLETE, onComplete);

function onComplete(event:Event):void

{

  var loader:URLLoader = event.target as URLLoader;

  if (loader != null)

  {

  XMLdoc = new XML(loader.data);

  }

  else

  {

  trace("loader is not a URLLoader!");

  }

}

Or did you compose XMLdoc somewhere else in Actionscript?

And are you sure that you want to pass those two parameters Arr:Array and txt.TextField to your function fl_bbbbb ? Whereby :TextField isn't really a Datatype used in Actionscript3, as far as I remember (it's a couple of years ago that I coded in AS3, nowadays it's all Javascript). But I'm pretty sure it should be txt:String. And Arr isn't even used in your function.

And what the heck is c ??? And you want to append another XML node (child) to c. Being the txt.text (st) passed on to your function?

Please, you have to explain more clearly what it is you want to do.

Klaus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 30, 2019 1
Community Beginner ,
Jan 31, 2019

Copy link to clipboard

Copied

sorry for taking so long to respond C is composed somewhere else in the document it is just part of the xml path I was just hoping to figure a way to have a generic path so I could shorten my code considerably.  It has come up a lot of times.  I suspect it is not an option but I was hoping

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 31, 2019 0