Solved

Creating an XML string

Posted on 2003-12-11
3
184 Views
Last Modified: 2010-04-03
In a recent project I have been working on, I have an input box that I have prevented users from entering in unapropriate words by using an array and a "for" loop.
This is what my code looks like.

badWords = ["milk", "juice", "cordial", "wine", "beer"];
mybutton.onRelease = function ()
{
     if (this._parent.txtBox.length > 0) {
          for (i in badWords) {
               if (txtBox.indexOf(badWords[i])>-1) {
          status = "No Swearing";
               return;
               }
          }
     }
}

How can I achieve this same idea, however using values from an external xml file?

Cheers

-OBCT
0
Comment
Question by:OBCT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Author Comment

by:OBCT
ID: 9926492
Sorry the title was meant to be "Creating an XML array"
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 9926699
OBCT, there's another thread asking a similar thing, though he wants to use attributes, and I couldn't get that to work properly.

In a normal xml setup. ie.

<xml>
<item1>milk</item1>
<item2>juice</item2>  
<item3>cordial</item3>
<item3>wine</item3>
</xml>

you can do this.

myXML = new XML();
myXML.load("xmlFileName.xml");
myXML.ignoreWhite = true;
myXML.onLoad = processXML;
function processXML() {
      wordArray = new Array();
      for (var n = 0; n<myXML.firstChild.childNodes.length; n++) {
            wordArray[n] = myXML.childNodes[0].childNodes[n].childNodes[0];
            trace(wordArray[n] add " array items");
      }
}

so you're creating an array in flash from an xml file.
0
 
LVL 9

Author Comment

by:OBCT
ID: 9926750
Thank you, blue. You are a genius :D
Cheers for that

-OBCT
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question