Solved

Filter Bad Words using flash mx 2004

Posted on 2004-08-19
4
552 Views
Last Modified: 2008-01-09
Hello, I'm creating a guestbook using flash with ASP. How can I filter bad words using Flash actionscripts. I dont have any idea how to do it in Flash MX 2004. The user will add a comment to a dynamic text with a variable "mess". What function will I use and how will I use it. thanx in advance.
0
Comment
Question by:bawasi
  • 2
4 Comments
 
LVL 1

Assisted Solution

by:cparcell
cparcell earned 150 total points
ID: 11840984
basically you want to create a list of "bad" words.

badWords = new Array();
badWords = ["xyz", "abc", "mno"];

Now you just check against the list you made.

userText = mess;
found = new Array();

for(n=0; n < badWords.length -1; n++){
    if(userText.indexOf(badWords[n]) != -1){
        found.push(userText.indexOf(badWords[n]));
    }
}

This will give you a list of the possition of all the bad words in the string.

Charles P.
0
 

Author Comment

by:bawasi
ID: 11849163
Thanks, but can I make it not case sensitive, because for example I made "xyz" as a badword, it will not consider "xYz" as a badword. And another thing is that, I made "ass" as a badword, he will already consider "assessment" as bad word.
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 100 total points
ID: 11850280
in terms of the case sensitive bit, you can just convert everything they type to lower case, and make sure all the words are lower case in the list. In terms of the ass and assessment bit, that's a tougher one.

if it was always the case that a character followed the "bad word" - you could simply check that there's no preceding character or character before it.
0
 

Author Comment

by:bawasi
ID: 11850773
Thanks. Thats a great suggestion for the case sensitive. But for the ass-assessment. I think I'm going to work on it some other time. thanks again.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

840 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