Hi!
I’ve built this fancy airport board application where you can write your sentance in the input field and by that change the board.
You can see here an example of what I have at the moment.
here’s the code I have:
//putting some starting text in the text field
input_txt.text = "Oceanic Flight 815";
//initializing variables
var holder_mc:Holder = new Holder();
var letter_mc:Letter = new Letter();
var sentance:String = new String(input_txt.text);
var arrayLetters:Array = sentance.split("");
//button CLICK listener and relative action
ok_btn.addEventListener(MouseEvent.CLICK, ok_btn_CLICK);
function ok_btn_CLICK(e:MouseEvent):void{
BuildSentance();
}
//The action that builds the sentances based on the input text
function BuildSentance():void{
for (var i:uint=0; i<arrayLetters.length; i++) {
//removeChild(holder_mc); ???? --> Need to remove holder_mc when already exists in order to reload the new sentance.
//Or somehow reload/refresh the sentance
//Need to somehow apply a timer that sets an interval of 1 second between the lettering fallout.
//Calls Holder from Library and adds it to the Stage (this will be the container for the sentance)
var holder_mc:Holder = new Holder();
this.addChild(holder_mc);
holder_mc.x = 10;
//breaking input text into letters
sentance = input_txt.text;
arrayLetters = sentance.split("");
//Calls Letter from Library and adds it to holder_mc
var letter_mc:Letter = new Letter();
holder_mc.addChild(letter_mc);
letter_mc.x = 17*i;
letter_mc.y = (10);
//Adds letters to letter_mc's
letter_mc.numbers1.letra_txt.text = arrayLetters*;
letter_mc.numbers2.letra_txt.text = arrayLetters*;
letter_mc.numbers3.letra_txt.text = arrayLetters*;
}
}
BuildSentance();
I’m having 2 problems:
- on applying some sort of timer that throws the sentance letters one of a time to the board;
- on updating the board, by removing the older sentance and throwing in the new one.
Can anybody help me on this?
Thanks in advance.