var fruit:Array = new Array();
var frName:String;
var i:Number;
save_btn.addEventListener(MouseEvent.CLICK, storeName);
function storeName(Event:MouseEvent)
{
frName = name_txt.text;
fruit[i] = frName;
i++;
}
detail_btn.addEventListener(MouseEvent.CLICK, dispName);
function dispName(Event:MouseEvent)
{
for(i=0; i<=1; i++)
{
trace(fruit[i]);
}
}
The script has two buttons: one for saving the text in a fruit array and the other for displaying the text.
However, when I click the display button, the script shows undefined as output in actionscript. Please help.