> That sounds totally counter to my experience, Danny.
Mine too. Plus - a simple test showed I was wrong:
function test(tVar:String) {
if (tVar == undefined) {
tVar = "hello"
}
}
test()
trace(tVar)
we get an undefined in the output window as expected.
I think it's another problem which was mentioned here before: the particular
variable I was using was a movieClip, and I was setting it to _root: (the
following is stripped down slightly, missing out the bit that actually does
anything...)
function findAllFields(tRoot:MovieClip) {
if (tRoot == undefined) {
var tRoot = _root;
}
for (var i in tRoot) {
var tMc = tRoot[i];
if ((tMc instanceof MovieClip) && (tRoot != tMc)) {
findAllFields(tMc);
}
}
}
The line which was causing the problem was 'var tRoot = _root', which was
changed from 'tRoot = _root'. Of course, now I can't replicate the problem,
so god knows what was happening...
> Something else must be going on. What's the error you're
> getting if you omit the 'var'?
I was getting a '256 levels of recursion' error: tMc would be a particular
clip, but by the time I got into the recursion, it had become _root again.
My guess is it was related to the problem we saw before that _root seems to
be an instance of some other object than MovieClip (something that extends
MovieClip, presumably), so at some stage it was getting confused. Oh well,
false alarm I guess. Which is good - the idea of unpicking years of code was
a bit daunting...
Danny
_______________________________________________
[email protected]
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