Copy link to clipboard
Copied
Need help identifying the error. Here is the code
// This line makes the button, btnCheck wait for a mouse click
// When the button is clicked, the checkWord function is called
btnCheck.addEventListener(MouseEvent.CLICK, checkWord);
// This is the checkWord function
// e:MouseEvent is the click event experienced by the button
// void indicates that the function does not return a value
function checkWord(e:MouseEvent):void
{
//declare the variables
var word:String;
// text in word
word = (txtinWord.text);
// reverse the word
if
(word = word); {
lblPalindrome.text = "This word is a palindrome";
}
else
{
lblPalindrome.text = "This word is not a palindrome";
}
}
program
I have found an Action Script code for Palindrome.
Please try the below code and let us know if that works for you.
function isPalindrome(str:String):Boolean
{
for(var first:uint = 0, second:uint = str.length - 1; first < second; first++, second--)
if(str.charAt(first) != str.charAt(second)) return false;
return true;
}
Thanks!
Ankush
Copy link to clipboard
Copied
Sorry, I don't see what this has to do with C++.
Copy link to clipboard
Copied
Its actionscript 3.0, I am using Adobe Animate. Thats all I know.
Copy link to clipboard
Copied
Never mind it saying c++
Copy link to clipboard
Copied
In the time that the expert gets back, have a look at this link for any insights https://snipplr.com/view/50850/palindrome/
Copy link to clipboard
Copied
I have found an Action Script code for Palindrome.
Please try the below code and let us know if that works for you.
function isPalindrome(str:String):Boolean
{
for(var first:uint = 0, second:uint = str.length - 1; first < second; first++, second--)
if(str.charAt(first) != str.charAt(second)) return false;
return true;
}
Thanks!
Ankush
Find more inspiration, events, and resources on the new Adobe Community
Explore Now