[COLOR=#333333][FONT=Segoe UI]Hi all. I tried this piece of code given below in CS3. I got the error listed below the code and there is nothing drawn on the screen. [/FONT][/COLOR]
I have created a DEL button on stage. Other than that the text fields do not dwar on stage.
var texts:Array = ['courses', 'tutorials', 'www.marplo.net']; // Array with text to displayvar bcolor:Array = [0xe8e9fe, 0xeded01, 0xfedada]; // Array with colors for the background of each text
var lung = 100; // Variable used for the lenght of the text field
// Reads through the "texts" Array
for(var i=0; i<texts.length; i++)
{
// creates a field "TextField" for each element in texts
// Sets the fields height, lenght, and distance "x" depending on "i" (for liniar display)
// Adds background color from "bcolor" Array and text from the current element in "texts"
var txt:TextField = new TextField();
txt.height = 25;
txt.width = lung;
txt.x = i*(lung + 8);
txt.backgroundColor = bcolor*;
txt.background = true;
txt.text = texts*;
// Atributin a name to the instance, for it to be unique also use 'i's value
txt.name = 'camp'+i;
addChild(txt); // Adds the field on the stage
}
// Recording CLICK event for the button on the stage, "remove_bt"
remove_bt.addEventListener(MouseEvent.CLICK, removeIns);
// The function called by the registered event
function removeIns(event:MouseEvent)
{
removeChild(getChildByName('camp0')); // Deletes the element with 'camp0' name
removeChild(getChildByName('camp1')); // Deletes the element with 'camp1' name
}
[COLOR=#333333][FONT=Segoe UI]
Can someone help me resolve this? Thanks to all.[/FONT][/COLOR]