Hello :) for me your method is not good :)
Use JSON or Eden format in your external text file. Example JSON = Javascript Object Notation ( http://json.org/ ) JSON is better to parse Array, Object, String, Boolean, Number ... You can use JSON with my openSource framework : http://code.google.com/p/vegas/ Serialize (ActionScript to String ) : import vegas.string.JSON ; var a:Array = [2, true, "coucou"] ; var o:Object = { prop1 : 1 , prop2 : 2 } ; var s:String = "hello world" ; var n:Number = 4 ; var b:Boolean = true ; trace("* a : " + JSON.serialize( a ) ) ; trace("* o : " + JSON.serialize( o ) ) ; trace("* s : " + JSON.serialize( s ) ) ; trace("* n : " + JSON.serialize( n ) ) ; trace("* b : " + JSON.serialize( b ) ) ; Deserialize (String to ActionScript ) import vegas.string.JSON ; var source:String = '[ { "prop1" : 0xFF0000 , "prop2":2, "prop3":"hello", "prop4":true} , 2, true, 3, [3, 2] ]' ; var o = JSON.deserialize(source) ; var l:Number = o.length ; for (var i:Number = 0 ; i<l ; i++) { trace("> " + i + " : " + o[i] + " -> typeof :: " + typeof(o[i])) ; if (typeof(o[i]) == "object") { for (var each:String in o[i]) { trace(" > " + each + " : " + o[i][each] + " :: " + typeof(o[i][each]) ) ; } } } If your string representation contains an error : import vegas.string.JSON ; import vegas.string.errors.JSONError ; var source:String = "[3, 2," ; try { var o = JSON.deserialize(source) ; } catch(e:JSONError) { trace( e.toString()) ; // output: [JSONError] Bad Array, at:6 in "[3, 2," } Now.. with a LoadVars : import vegas.string.JSON ; var result ; var loader = new LoadVars() ; loader.onData = function ( source:String ) { result = JSON.deserialize(source) ; trace(result) ; } loader.load("data.txt") ; In your external data.txt you can write an array with the Javascript notation : [ 1 , 2 , true, "hello world" , { "prop1" : "value1", "prop2" : "value2" } , 0xFF0000 ] To install my framework you can read this page : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN More easy... more speed :) EKA+ :) 2007/5/5, John Trentini <[EMAIL PROTECTED]>:
Thanks sebastian, I had tried something like: menuLoadVars.onLoad = function(){ var my = menuLoadVars.split("\r"); for (var i = 0; i<my.length; i++) { trace(my[i]) } } No joy, perhaps I am using the wrong syntax? _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com