AS3 text linkage to xml
You have several problems in your code:
You don't wait for XML, and start ENTER_FRAME with access to myItems
There is no sense in additional information in the XML, because you apply same texts to the both fields.
function onMoveTexts(e:Event):void {
my_text.x -= scrolling_speed;
mySmallTextField.x -= scrolling_speed2;
if (my_text.x < -my_text.width) {
my_text.x = stage.stageWidth;
if (myItems != null) {
//Set next text
if (++position >= myItems.length()) {
position = 0;
}
my_text.text = myItems[position];
}
}
if (mySmallTextField.x < -mySmallTextField.width) {
mySmallTextField.x = stage.stageWidth;
if(myData != null){
mySmallTextField.text = myData.anotherData.info;
}
}
}
Or start your loop after you get XML:
function onComplete(e:Event):void {
myData = new XML(URLLoader(e.currentTarget).data);
myItems = myData..item;
//add the listener to scroll
addEventListener(Event.ENTER_FRAME, onMoveTexts);
}