0
Пожалуйста, помогите мне изменить код AS3 для чтения текста из массива, а не из xml.Изменение AS3 для чтения текста из массива не из xml
исходный код:
function readTheText() {
// Zeroing the TEXT
// ------------------------------------------
DisplayHolder.MultiLetters_MC.TheText = "";
// clear the previous interval
clearInterval(PhraseChange);
// ------------------------------------------
// Reading the text from the XML
// ------------------------------------------
for (i=0; i < NumOfLines; i++) {
this["textLine"+i] = myXml.firstChild.childNodes[LinesCount].childNodes[i].firstChild.nodeValue;
if (this["textLine"+i] == undefined){
this["textLine"+i] = " ";
}
padLength = NumOfLettersInLine - this["textLine"+i].length;
// Add padding if necessary
if (padLength > 0){
for (p=0; p < padLength; p++) {
this["textLine"+i] += " ";
}
} else {
// Subtract letters if necessary
var theString:String = this["textLine"+i];
var theSubString:String = theString.substring(0,NumOfLettersInLine);
this["textLine"+i] = theSubString;
}
// Our final text
DisplayHolder.MultiLetters_MC.TheText += this["textLine"+i];
}...
заменить чтение из XML с:
var group1:Array = ['DRIFT', 'FRESH&TONIC', 'SHIT ON GRASS', 'DOWNTOWN', 'AGED NEGRONI', 'FIREBALL', 'B5200', 'BLACK JACK', 'HOT WORM'];
var texts:Array = [];
наилучшими пожеланиями
Я не понимаю, что это ваша проблема, но если вы хотите, чтобы читать элементы массива вы должны просто использовать 'for' петлю. Взгляните на [работа с массивами] (http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7fdc.html) с help.adobe.com. – akmozo