Maybe Try
var evalJ = eval(j);
var evalK = eval(k);
totalItems = evalJ + evalK;
Evaluate the strings before you combine them?
Karl
On Aug 13, 2011, at 1:52 PM, John Polk wrote:
From: Henrik Andersson <he...@henke37.cjb.net>
To: Flash Coders List <flashcoders@chattyfig.figleaf.com>
Sent: Friday, August 12, 2011 1:43 PM
Subject: Re: [Flashcoders] Simplify XML Call
ActionScript 3 is a compiled language. There is no such thing as an
eval function in as 3.
Well, that's the crux of my problem, Henrik. How do I get around
writing code that adds just the right number of "item units" without
doing it as a string to evaluate or writing a switch statement
that's obviously limited? Again, here's my pseudo-code:
var j:String = "xml.menu.item[whichItems[0]]";
var k:String = new String();
var l:int = level; // I don't know this value in
advance: it's passed to the class
while (l--)
{
k += ".item[whichItems[" + String(l) + "]]";
}
totalItems = eval(j + k); // "eval()" doesn't work in
AS3, concept from Python
TIA,
John
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Karl DeSaulniers
Design Drumm
http://designdrumm.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders