I'm trying to convert a percent to a decimal once a button is clicked.
I have an input text field for user input and another under it, which is
a dynamic text field to just show the result after the button is clicked.
I have two classes: main and my utility class for the math.
My problem is I don't know how to call the function from
the util class in the main class to get this working.
I can't get this last part working. here is my code:
public class Main extends Sprite
{
private var pResult:TextField;
private var pResult2:TextField;
public function Main()
{
super();
// calling all the functions below
// adding my graphics to the display
var baseDBase = new PDBase();
this.addChild(base);
base.x = -70;
base.y = 30;
//changing the font format
var format:TextFormat = new TextFormat();//adding the object
format.size = 14;//font sizing
format.align = TextFormatAlign.LEFT;//font align
//result text field
pResult = new TextField();//adding the object
this.addChild(pResult);//displaying the object
pResult.border = true;//setting the border
pResult.borderColor = 0x30FF00;//setting border color
pResult.textColor = 0x000000;//setting the font color
pResult.x = 28;//position left or right
pResult.y = 70;//position up or down
pResult.width = 142;// changing width
pResult.height = 20;// changing height
pResult.type = TextFieldType.INPUT;//making sure the text area is for input
pResult.defaultTextFormat = format;//sets text format to defult
pResult.maxChars = 32;//text limit of characters
pResult.restrict = "0-9.";//fonts used only
pResult2 = new TextField();//adding the object
this.addChild(pResult2);//displaying the object
pResult2.border = true;//setting the border
pResult2.borderColor = 0x30FF00;//setting border color
pResult2.textColor = 0x000000;//setting the font color
pResult2.x = 28;//position left or right
pResult2.y = 96;//position up or down
pResult2.width = 142;// changing width
pResult2.height = 20;// changing height
pResult2.type = TextFieldType.DYNAMIC;//making sure the text area is for input
pResult2.defaultTextFormat = format;//sets text format to defult
pResult2.maxChars = 32;//text limit of characters
pResult2.restrict = "0-9.";//fonts used only
var button:Button = new Button("Calculate");
this.addChild(button);
button.x = 10;
button.y = 130;
button.addEventListener(MouseEvent.CLICK, btn_EventListener);
}
private function btn_EventListener(e:MouseEvent):void
{
MathUtil.percentToDecimal(percent)
this.pResult2.text = percent;
}
}
public class MathUtil
{
public function MathUtil()
{
}
public static function percentToDecimal(percentValue:Number):Number
{
var percent:Number = percentValue * 100;
var roundedDecimal:Number = Math.round(percent);
var percentResult:String = roundedDecimal;
return percentResult;
}
}
I'm also getting this error:
1067: Implicit coercion of a value of type Number to an unrelated type String.
On var percentResult:String = roundedDecimal;
this.pResult2.text = String(MathUtil.percentToDecimal(percent));
Note that your function returns a value, so if you will do this, the returned value will be assigned to textfield. "String()" is casting a returned number to string.
Edit:
Ah, and here you can use casting:
var percentResult:String = String(roundedDecimal);
Related
public class Hangman extends Sprite {
private var textDisplay:TextField;
private var phrase:String = "Recycled"
private var phrase:String = "Stamped"
private var phrase:String = "grandpa"
"What I want to do here is to randomise the "phrase:String", so that the phrase outcome will be either recycled, stamped or grandpa.
private var shown:String;
private var numWrong:int;
public function Hangman() {
// create a copy of text with _ for each letter
shown = phrase.replace(/[A-Za-z]/g,"_");
numWrong = 0;
...codes*
}
public function pressKey(event:KeyboardEvent) {
// get letter pressed
var charPressed:String = (String.fromCharCode(event.charCode));
// loop through nd find matching letters
var foundLetter:Boolean = false;
for(var i:int=0;i<phrase.length;i++) {
if (phrase.charAt(i).toLowerCase() == charPressed) {
// match found, change shown phrase
shown = shown.substr(0,i)+phrase.substr(i,1)+shown.substr(i+1);
foundLetter = true;
}
}
// update on-screen text
textDisplay.text = shown;
// update hangman
if (!foundLetter) {
numWrong++;
character.gotoAndStop(numWrong+1);
}
}
}
}
I hope someone can help me on this one. Thank you.
You cannot have the same variable being instantiated with the same name... if you want, use an array to keep the possible words...
var phrase:Array = [ "Recycled", "Stamped", "grandpa", ...];
Then, use a Random function to select a number from 0, up to array size, then use that word...
var word = phrase[Math.floor(Math.random()*phrase.length)];
I have a problem with formatting the text field. I have buttons + and - to size of text. TextField class has property defaultTextField for new text formatting. And when I change defaultTextFormat size property - whole text's size changes. I have searched for solution everywhere and I haven't found it yet. Text editor WISWYG (I am not sure if name is right) is working well with just changing defaultTextFormat property while I have issue. Maybe it happens because of difference between flash and AIR (editor on flash and my app on AIR). Please help.
Here code to set/get TextFormat:
public function set selectionTextFormat(value:TextFormat):void {
var begin:int = _textField.selectionBeginIndex;
var end:int = _textField.selectionEndIndex;
if (begin == end)
{
_textField.defaultTextFormat = value;
}
else
{
_textField.setTextFormat(value, begin, end);
}
}
public function get selectionTextFormat():TextFormat
{
var begin:int = _textField.selectionBeginIndex;
var end:int = _textField.selectionEndIndex;
if (begin == end)
{
return _textField.defaultTextFormat;
}
return _textField.getTextFormat(begin, end);
}
And code to change format:
private function setFormat(property:String, value:*):void
{
var tf:TextFormat = TextFormatter.TF.selectionTextFormat;
tf[property] = value;
TextFormatter.TF.selectionTextFormat = tf;
}
EDIT : IMAGE ON DROPBOX FOR EXPLANATION:
https://dl.dropboxusercontent.com/u/237572639/Capture.PNG
EDIT 2: IMAGE OF WHAT I NEED (CODE IS ABSOLUTELY SAME!) (WYSIWYG editor)
https://dl.dropboxusercontent.com/u/237572639/WYSIWYG.PNG
To change all future typed text, you can try this code ( the result is visible here ):
var text_input:TextField = new TextField();
text_input.border = true;
text_input.type = 'input';
text_input.text = 'hello world!';
addChild(text_input);
var new_fmt:TextFormat = new TextFormat();
btn_color.addEventListener(
MouseEvent.CLICK,
function(e:MouseEvent):void {
// set the new text color
new_fmt.color = 0xFF0000;
}
)
btn_size.addEventListener(
MouseEvent.CLICK,
function(e:MouseEvent):void {
// set the new text size
new_fmt.size = int(txt_size.text)
}
)
text_input.addEventListener(Event.CHANGE, function(e:Event):void {
text_input.setTextFormat(new_fmt, text_input.caretIndex-1);
})
Of course, this is just a manner to do what you want, you have to adapt it to your need and improve it.
I've created a list but I don't know how to increase the size of cells.
So I've got this problem : http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-6166126-569357/450-446/test2.png
Do you how I can solved it ?
Here is my code :
package ca.xty.myUtils {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.utils.*;
import fl.controls.List;
import fl.controls.Button;
import flash.text.AntiAliasType;
import fl.data.DataProvider;
public class AutoComplete extends Sprite {
// These constant variables will be used in our event dispatches
public static const SHOW_LIST:String = "SHOW_LIST";
public static const MADE_CHOICE:String = "MADE_CHOICE";
// These variables will be used to get information back to our Document Class which is why they have a public declaration
public var aIndex:int;
public var noResult:String;
// These variables will hold the information contained in the parameters passed in the constructor
private var _passedArray:Array;
private var _txtWidth:int;
private var _txtHeight:int;
private var _whichProperty:String;
private var _btnTxtColor:Number;
// Display variables
private var acList:List;
private var acArray:Array;
private var listHeight:int = 100;
private var listHeightCalc:int;
private var searchBtn:Button;
private var sTerm:String;
private var acTxt:TextField;
// TextFormats
private var titleFormat:TextFormat;
private var topBtnFormat:TextFormat;
// Convenience variables for loops
private var i:uint;
private var len:uint;
public function AutoComplete(PassedArray:Array, WhichProperty:String, TxtWidth:int, TxtHeight:int, BtnTxtColor:Number = 0x000000) {
// Place the parameter values passed in the constructor into our private vars
_passedArray = PassedArray;
_txtWidth = TxtWidth;
_txtHeight = TxtHeight;
_whichProperty = WhichProperty;
_btnTxtColor = BtnTxtColor;
// Give our TextFormats some properties
titleFormat = new TextFormat();
titleFormat.size = 23;
titleFormat.font = "ARIAL";
titleFormat.leftMargin = 3;
topBtnFormat = new TextFormat();
topBtnFormat.color = 0x000000;
topBtnFormat.size = 40;
topBtnFormat.font = "ARIAL";
// Call the function to build the display
buildAC();
}
private function buildAC():void{
// This is the TextField users will type in what they want to search for
// It takes it's width and height from the variables passed in the constructor
// The event listener responds to any change in the TextField
var tf:TextFormat = new TextFormat();
var myFormat:TextFormat = new TextFormat();
tf.size = 50;
myFormat.size = 50;
tf.font = "Time New Roman";
acTxt = new TextField();
acTxt.defaultTextFormat = tf;
acTxt.x = -20;
acTxt.y = 0;
acTxt.width = 670;
acTxt.height = 120;
acTxt.type = "input";
acTxt.border = true;
acTxt.background = true;
acTxt.textColor = 0x000000;
acTxt.backgroundColor = 0xffffff;
acTxt.antiAliasType = AntiAliasType.ADVANCED;
acTxt.sharpness = 100;
acTxt.thickness = 100;
acTxt.addEventListener(Event.CHANGE, updateDisplay);
addChild(acTxt);
// Our Search Button
searchBtn = new Button();
searchBtn.x = 140;
searchBtn.y = 130;
searchBtn.width = 300;
searchBtn.height = 125;
searchBtn.label = "RECHERCHER";
searchBtn.setStyle("textFormat", topBtnFormat);
searchBtn.addEventListener(MouseEvent.CLICK, searchHandler);
addChild(searchBtn);
// The List component that will display the auto-complete results
// Notice it has the visibale property set to false
// It's event listener responds to a change, ie an item is clicked
acList = new List();
acList.setRendererStyle('textFormat',myFormat);
acList.x = -20;
acList.y = acTxt.y + acTxt.height;
acList.setSize(645, 0);
acList.visible = false;
acList.addEventListener(Event.CHANGE, listHandler);
addChild(acList);
}
// This is the function that fires when there is a change in the acTxt field
private function updateDisplay(e:Event):void{
// We set our variable sTerm to equal the value of the acTxt field
sTerm = acTxt.text;
// Set the sTerm to lower case
sTerm = sTerm.toLowerCase();
// Create an empty version of our acArray
acArray = new Array();
// Set the len variable to be that of the array we passed in through the constructor
len = _passedArray.length;
// Run a for loop to look through the array for items which match the sTerm
for(i = 0; i < len; i++){
// Create a variable to hold the first label item in our array and set it to be lower case
var firstLabel:String = _passedArray[i][_whichProperty].toLowerCase();
// Create a variable for the firstLetter using a sub string - the actual length of firstLetter will be determined by
// the length of sTerm so that firstLetter might really be first two letters...
var firstLetter:String = firstLabel.substr(0, sTerm.length);
// if the firstLetter var matches the STerm then we push corresponding item from the passed array into our acArray
if(firstLetter == sTerm){
acArray.push({label:_passedArray[i][_whichProperty], data:i});
}
}
// Once we've run through the whole array we calculate the List height
listHeightCalc = acArray.length * 20;
// if the calculated list height is greater than the variable listHeight then we set the height of the list to be listHeight ( our maximum height )
// otherwise we set the height of the list to the calculated height
if(listHeightCalc > listHeight){
acList.height = listHeight;
}else{
acList.height = listHeightCalc;
}
// Clear our our List
acList.removeAll();
// Use the new acArray as the data provider
acList.dataProvider = new DataProvider(acArray);
// Make the list visble
acList.visible = true;
// Dispatch the event that will make sure the list is on top of all the othe diaply items
dispatchEvent(new Event(AutoComplete.SHOW_LIST, true));
}
// This function handles the clicking of oneof the items in the List
private function listHandler(e:Event):void{
// Put the selected item's label in the acTxt field
acTxt.text = e.target.selectedItem.label;
// grab the data from the selected item and assign it to the aIndex variable
aIndex = e.target.selectedItem.data;
// Put the List's visibility back to false;
acList.visible = false;
// Dispatch the event to the Document class
dispatchEvent(new Event(AutoComplete.MADE_CHOICE, true));
}
// This function handles a click of the Search Button
private function searchHandler(e:MouseEvent):void{
// Reset the acArray to a nice new empty array
acArray = new Array();
// Reset the List's visible property to false;
acList.visible = false;
// Assign the contents of the acTxt field to our sTerm variable
sTerm = acTxt.text;
// Set the sTerm to lower case
sTerm = sTerm.toLowerCase();
// Loop throught the array and put matching items into our acArray
for(i = 0; i < len; i++){
var firstLabel:String = _passedArray[i][_whichProperty].toLowerCase();
trace("firstLabel: " + firstLabel);
trace("sTerm: " + sTerm);
if(firstLabel.indexOf(sTerm) != -1){
acArray.push({label:_passedArray[i][_whichProperty], data:i});
}
}
// Check to see if the calculated height for the List is bigger than the maximum height we set and build the List accordingly
listHeightCalc = acArray.length * 20;
if(listHeightCalc > listHeight){
acList.height = listHeight;
}else{
acList.height = listHeightCalc;
}
// If our acArray's length is greater than one we want to use the List to show you the result options
// Once again we dispatch the event that will make sure the List is on the top of the diaply heap
if(acArray.length > 1){
acList.removeAll();
acList.dataProvider = new DataProvider(acArray);
acList.visible = true;
dispatchEvent(new Event(AutoComplete.SHOW_LIST, true));
// If our acArray's length is equal to 1, no need to set up the List, just stick it in our acTxt field
// This time we dispatch the event that will display the results
}else if(acArray.length == 1){
acTxt.text = acArray[0].label;
aIndex = acArray[0].data;
dispatchEvent(new Event(AutoComplete.MADE_CHOICE, true));
// If there are no results from our search, we set the aIndex variable to -1, create our noResults string and dispatch the event to display that result
}else{
aIndex = -1;
noResult = "No Results for " + acTxt.text;
dispatchEvent(new Event(AutoComplete.MADE_CHOICE, true));
}
}
}
}
If you want to increase height of list's cell then use,
acList.rowHeight = 50;
I am trying to develop an application in AS3. What I am really trying to achieve is to have only one datagrid and having it show, you say, three different set of datas. (the real count will be changing dynamically, and it does not matter as the problem is not relevant with this) Yes, it has to be only one datagrid because of you know, I need a compact interface.
The class "Sonuc" has three properties which are string versions of inputs from constructor. A typical "Sonuc" object is something like this.
var sonuc1:Sonuc = new Sonuc(1,1,false);
//sonuc1.num = "1"
//sonuc1.type = "1"
//sonuc1.isTrue = "No"
The reason that I have informed you about "Sonuc" class is that I wanted you to know that class was not something too complicated. And x.mxml is the test mxml where I only load the class for testing purposes.
This is what I have coded so far
public class ResultInterface extends UIComponent
{
private const desiredWidth:int = 250;
private const desiredHeight:int = 150;
private const sonuc1:Sonuc = new Sonuc(1,1,false);
public var tablo:DataGrid = new DataGrid();
public var kolonArray:Array = new Array ();
public var sonucArray:Array = new Array ();
public var currentIndex:int = new int ();
public var prevButon:Button = new Button();
public var nextButon:Button = new Button();
public function ResultInterface():void
{
currentIndex = 0;
super();
tablo = new DataGrid();
width=desiredWidth+40;
height=desiredHeight+60;
this.tablo.width = desiredWidth;
this.tablo.height = desiredHeight;
this.tablo.x = 20;
this.tablo.y = 40;
prevButon.x = 10;
prevButon.y = genislik/2 - 10;
prevButon.width =
prevButon.height = 10;
nextButon.x = genislik +20;
nextButon.y = genislik/2 -10;
nextButon.width =
nextButon.height = 10;
var referansColl:ArrayCollection = new ArrayCollection();
sonucArray.push(referansColl);
tablo.dataProvider = sonucArray[currentIndex];
var sampleCol:DataGridColumn = new DataGridColumn();
sampleCol.dataField = "num";
sampleCol.headerText = "Number";
var sampleCol2:DataGridColumn = new DataGridColumn();
sampleCol2.dataField = "type";
sampleCol2.headerText = "Type";
var sampleCol3:DataGridColumn = new DataGridColumn();
sampleCol3.dataField = "isTrue";
sampleCol3.headerText = "Is it true?";
kolonArray.push(sampleCol,sampleCol2,sampleCol3);
tablo.columns = kolonArray;
this.addElement(tablo); //**** this is the problematic line
this.addChild(oncekiButon);
this.addChild(sonrakiButon);
}
public function getNewSonuc(incoming:Sonuc):void
{
sonucArray[currentIndex].addItem(incoming);
}
public function newTablo():void
{
var newTablo:ArrayCollection = new ArrayCollection();
currentIndex = sonucArray.push(newTablo);
}
public function prev(evt:Event):void //I haven't written event listeners yet
{
if(currentIndex > 0)
currentIndex--;
nextButon.enabled = true;
if(currentIndex == 0)
prevButon.enabled = false;
}
public function birSonrakine(evt:Event):void
{
if(currentIndex < sonucArray.length)
currentIndex++;
prevButon.enabled = true;
if(currentIndex == sonucArray.length)
nextButon.enabled = false;
}
in this version, I get a syntax error "call to a possibly undefined method addElement"
I also tried having the base class as "Sprite" and "Canvas"
when I used addChild instead of addElement, then I get runtime error "addChild is not available to this class"
when I just commented the problematic line out, everything was loaded perfectly but the datagrid itself.
Note that error occurs before sending in some data (Sonuc) to datagrid.
and when I tried with canvas and with addelement, I get "Cannot access a property or method of a null object reference" with some weird functions and classes and packages.
1009: Cannot access a property or method of a null object reference.
at mx.styles::StyleProtoChain$/initProtoChainForUIComponentStyleName()[E:\dev\4.y\frameworks\projects\framework\src\mx\styles\StyleProtoChain.as:358]
at mx.styles::StyleProtoChain$/initProtoChain()[E:\dev\4.y\frameworks\projects\framework\src\mx\styles\StyleProtoChain.as:171]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::initProtoChain()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:10926]
at mx.core::UIComponent/regenerateStyleCache()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:10989]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7465]
at mx.core::UIComponent/addChild()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7162]
at mx.controls.listClasses::ListBase/createChildren()[E:\dev\4.y\frameworks\projects\mx\src\mx\controls\listClasses\ListBase.as:3772]
at mx.controls::DataGrid/createChildren()[E:\dev\4.y\frameworks\projects\mx\src\mx\controls\DataGrid.as:1143]
at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]
at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:3974]
at mx.core::Container/addChildAt()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:2618]
at mx.core::Container/addChild()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:2534]
at mx.core::Container/addElement()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:2981]
at genel.siniflar::ResultInterfaceArayuz()[C:\Users\Ege\Adobe Flash Builder\brainswift2\src\genel\siniflar\ResultInterface.as:95]
at x()[C:\Users\Ege\Adobe Flash Builder\brainswift2\src\x.mxml:27]
at _x_mx_managers_SystemManager/create()[_x_mx_managers_SystemManager.as:54]
at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:311]
at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:3057]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2843]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2723]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:542]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
I really need your help folks, please answer as soon as possible.
Well, I tried calling "addElement" from outside of the constructor, and it worked. However I don't know what did exactly cause this error and I know that my solution is not a legitimate one. And I would like to learn proper solution to this problem.
changes to resultInterface.as
// this.addElement(tablo); **** this is the problematic line, we have commented it out
this.addChild(oncekiButon);
this.addChild(sonrakiButon);
changes to x.mxml
public function onCreationComplete(evt:Event):void
{
showResult.addElement(showResult.tablo);
addElement(showResult);
}
i have a TheList.as class..in which i have created a list for an android app.
Here is TheList.as(Cut down to the specific stuff for this question)
public var _ListItem:ListItem;
public var _Data:Array;
public var _Values:Array;
public var $CurrentValue:String;
public var _TextLabel:TextField;
public function TheList(Data:Array,Values:Array)
{
_Data = Data;
_Values = Values;
initialize();
}
private function initialize():void
{
_TextLabel = new TextField();
addChild(_TextLabel);
_TextLabel.text = "Data";
_Container = new ListContainer ;
addChild(_Container);
_Container.x = 0;
_Container.y = 0;
currentY = _Container.y;
lastY = _Container.y;
for (var i:int = 0; i < _Data.length; i++)
{
_ListItem = new ListItem ;
_Container.addChild(_ListItem);
_ListItem.y = _ListItem.height * i;
_ListItem.addEventListener(MouseEvent.MOUSE_DOWN,onItemDown,false,0,true);
_ListItem.addEventListener(MouseEvent.MOUSE_UP,onItemUp,false,0,true);
_ListItem.mouseChildren = false;
_ListItem.value = _Values[i];
_ListItem.name = _Data[i];
_ListItem.ItemLabel.text = _ListItem.name ;
}
}
Here is the class "TheList" is being used in (Again Cut Down to specific stuff)
$myList = new TheList($Data,$Values);
addChild($myList);
$myList.x = -240;
$myList.y = -203;
$myList.visible = false;
$ListFrom = new TheList($DataFromTo, $ValuesFromTo);
addChild($ListFrom);
$ListFrom.x = -240;
$ListFrom.y = -203;
$ListFrom.visible = false;
$ListFrom._TextLabel.text = $DataFromTo[0];
$ListTo = new TheList($DataFromTo, $ValuesFromTo);
addChild($ListTo);
$ListTo.x = -240;
$ListTo.y = -203;
$ListTo.visible = false;
$ListTo._TextLabel.text = $DataFromTo[0];
Now what i am trying to achieve is that i want to change "$Data" and "$Values" Arrays..as you can see i have a main list and two sublists... when "Time" is selected in the main list, i want the sub-lists to be populated with "Time" related unit names...i tried
if($myList._TextLabel.text == "Time")
{
$ListFrom._Data = ["this", "this", "this" etc]
}
But its not working. I am not getting any error either. I'd really appreciate any help!
What you try to achieve is not pissible in this way. You initialize you lists with data fields. When you reset the data, you need to invalidate your list again. You can achieve this with an item setter
private var __Data:Array;
public function get _Data():Array
{
return __Data;
}
public function set _Data(value:Array):void
{
this.__Data = value;
initialize();
}
make sure that you first cleanup you list before you rebuild it again.
your code:
$ListFrom._Data = ["this", "this", "this" etc]
will automaticly call the setter. A getter and setter method looks like a function but is invoked like a property. means:
object.property = "something" //will call the setter
var something:String = object.property //will call the getter