PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
XML Object Can not check if contains String Variable?
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: XML Object Can not check if contains String Variable?

  1. #1
    The Flash AS Newb
    Join Date
    May 2006
    Location
    Australia
    Posts
    179

    XML Object Can not check if contains String Variable?

    Hey everyone,

    I am developing an application in AS3 for Android devices and I am choosing to use XML for setting storage...

    Unfortunately I have been able to test using the contains method whether there is the correct text in the XML file I have tried to use this...

    Code:
    	var updates:Boolean = true;
    	var k:Number = 0
    	for(k = 0; k < 6; k++){
    		if(localXML.Party[k]){
    		if(localXML.Party[k].contains("<name>" + List.selectedItem.label + "</name>")){
    	   		updates = false;
    			trace("TRIGGERED");
    	   }
    		}
    	}
    	if(updates){
    		trace("NOT TRIGGERED");
    	localXML.prependChild(<Party></Party>);
    	localXML.Party[0].prependChild(<Name></Name>);
    	localXML.Party[0].Name = List.selectedItem.label;
    	}
    Which is never triggered does anyone have any ideas on how I may fix this?

    Thanks,
    Kriogenic.

  2. #2
    Member
    Join Date
    Apr 2010
    Posts
    87
    XML.contains accepts argument of type XML where you're passing String
    Actionscript Code:
    if(localXML.Party[k].contains("<name>" + List.selectedItem.label + "</name>")){
    this way please
    Actionscript Code:
    if(localXML.Party[k].contains(new XML("<name>" + List.selectedItem.label + "</name>"))){

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center