Solved

Creating an XML string

Posted on 2003-12-11
3
180 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Inserting a pop up image to a scanned PDF 5 435
Need to show horrizontal scrollbar for AdvancedDatagrid next to freezed columns. 4 312
FLV versus SWF 11 270
EMET 5.2 / Adobe Flash 2 229
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,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now