Archive for June, 2010


Here, I have made some code stuff which could create object looping and can access each object’s property from outside of loop

// importing reated files
import flash.display.Sprite;
import flash.text.TextField;

// Varial declearation
var answer:Array=new Array();
var ansGroup:Array=new Array();
var options:Sprite=new Sprite();

answer[0]=[“nepal”,”china”,”bhutan”,”usa”];
answer[1]=[“Lichi”,”mango”,”banana”,”apple”];
answer[2]=[“sunday”,”monday”,”tuesday”,”saturday”];
answer[3]=[“cat”,”lion”,”monkey”,”donkey”];

for(var i:Number=0; i<4; i++){
// making object
var myTextField:TextField=new TextField();

// Setting property of created object
myTextField.x=i*130;
myTextField.y=25;
myTextField.width=120;
myTextField.height=25;
myTextField.text=answer[0][i];
myTextField.border=true;

// put into ansGroup Array
ansGroup.push(myTextField);

// put into displaycontainer options
options.addChild(myTextField);

}
// Setting displaycontainer property of x and y position
options.y=100;
options.x=25;

// displaying displayContainer
addChild(options);

Combo Box Component in AS3

Please drag comboBox from componet and set parameter true for editable parameter.

import fl.data.DataProvider;
import fl.events.ComponentEvent;
var count:Number=0;
var myArray:Array=[
{label:”Nepal”, data:”nepal”},
{label:”Dhoti”, data:”dhoti”},
{label:”USA”, data:”usa”}

];
cm.dataProvider=new DataProvider(myArray);
/*
For dynamic addValue into combo list we have this simple addItemAt function
cm.addItemAt({label:”xx”, data:”xx”}, comboBoxIndex);

Ex :
cm.addItemAt({label:”Nepal”, data:”nepal”},0);
*/