[mtasc] may be small issue report

Lorenzo Sicilia arnor at kemen.it
Wed Feb 2 11:17:34 CET 2005


May be I found a small issue.Otherwise I don't understand something 
about mtasc :)

I do a small test to reproduce it.

When I try:
_root.log.text += "label:" + col.get("two").label +"\n";
I get no output in my log TextField.

Otherwise if I use a temp var it works fine:
var o1 = col.get("one");
_root.log.text += "label:" + o1.label +"\n";

With MM compiler it works fine.



regards Lorenzo



## Test class
import test.Collection;

class test.Test {
	private var log:Logger;
	private var textLogView:TextFieldView;
	private var col:Collection;

     function Test() {
     	 _root.createTextField("log",0,0,0,800,600);
	col = new Collection();
	col.put({label:"one", data:"1"});
	col.put({label:"two", data:"2"});

	_root.log.text += "-- -- -- -- -- \n";
	_root.log.text += "label:" + col.get("one").label +"\n";
	_root.log.text += "label:" + col.get("two").label +"\n";
	var o1 = col.get("one");
	_root.log.text += "label:" + o1.label +"\n";
	_root.log.text += "-- -- -- -- -- \n";
     }

     static function main() {
         var t = new Test();
     }
}

## Collection class

class test.Collection {
	private var data:Array;
	
	public function Collection(){
		data = new Array();
	}
	
	public function put(o:Object){
		data.push(o);
	}
	
	public function get(key:String):Object{
		var data;
		for (var i:String in this.data){
			if(this.data[i].label == key){
				data = this.data[i];
				break;
			}
		}
		return data;
	}
}




More information about the mtasc mailing list