PDA

View Full Version : why did I miss??


kiwi1066
08-10-2009, 01:24 PM
This is the code in the constructor of the package

public static function get getQuotesb() :String
{

var b221:String = "this is quote 221 ";
var b222:String = "this is guote 222";
var b223:String = "this is quote 223";
var b224:String = "this is guote 224";

dayOfYear = DayOfYear.getDayOfYear;
var quoteNumber:String = "b" + dayOfYear;
quote = quoteNumber;
trace(quote);
return quote;
}

based on today, quoteNumber is b222.
If I add in 'trace(quoteNumber); I get b222
Therefore I think it should trace "this is quote 222"
But it traces 'b222'
If I I replace 'quote = quoteNumber' with 'quote = b222'
I get the trace I was expecting ' this is quote 222'

Why does using the variable name not work? :confused:

attunedesigns
08-10-2009, 03:24 PM
trace(this[quote]);

wvxvw
08-10-2009, 03:40 PM
Flash doesn't save names of the local variables in functions - they all have just id's like #0, #1, etc. Make them properties of some object / array members / dictionary keys / XML nodes etc.

henke37
08-10-2009, 03:59 PM
The real problem is that he expects a random string variable to act like a pointer. I would revoce his programing license if I could.

attunedesigns
08-10-2009, 04:03 PM
say what?

wvxvw
08-10-2009, 04:58 PM
The real problem is that he expects a random string variable to act like a pointer. I would revoce his programing license if I could.

Speaking of licenses... there're so many diploma-owners whom I wish to exchange their programming licenses for the life-time mandatory fishing licenses, if I could...
Well, nevermind... :) But the OP doesn't really deserve that tough treat.

kiwi1066
08-10-2009, 10:08 PM
Thanks for the tips.
To be able to have access to your knowledge, skills and experience provides those of us that would otherwise struggle to work towards getting a licence an oppotunity to learn and hopefully be able to assist others in the future.

Your time and effort in sharing and helping others is much appreciated. :)