コードに関するちょっとしたヒントを得るためにこのサイトを使用するのが大好きで、自分でできるすべてのエラーを解決しようとしています。しかし、これは私を何日も困惑させました。私はそれをクラックすることはできません。
RangeError: エラー #2006: 指定されたインデックスが範囲外です。flash.text::TextField/setTextFormat() で BibleProgram_fla::MainTimeline/checkAgainstBible() で BibleProgram_fla::MainTimeline/compileInputString() で BibleProgram_fla::MainTimeline/spaceBuild()
function spaceBuild(event:Event):void //This program runs every frame
{
compileInputString();
}
function compileInputString():void
{
inputVerse = inputText.text; // takes text from the input field
inputVerse = inputVerse.toLowerCase();
inputVerse = inputVerse.replace(rexWhiteSpace, ""); //Removes spaces and line breaks
inputVerse = inputVerse.replace(rexPunc, ""); // Removes punctuation
inputVerse = addSpaces(inputVerse); //adds spaces back in to match the BibleVerse
inputVerse = addCaps(inputVerse); //adds capitalization to match the BibleVerse
checkAgainstBible();
}
function checkAgainstBible()
{
outputText.text = inputVerse; // sets output text to be formatted to show which letters are wrong
for(var n:Number = 0; n < inputText.length; n++)
{
var specLetter:String = inputVerse.charAt(n);
if(specLetter != bibleVerse.charAt(n))
{
outputText.setTextFormat(red, n); // sets all of the wrong letters to red
}
}
}
プログラムを実行して、BibleVerse よりも長い文字列を入力すると、エラーが返されますが、修正方法がわかりません。
あなたが私を助けるのに十分な情報を提供したことを願っています. さらにコードなどが必要な場合は、お問い合わせください。前もって感謝します!!