FORUMS: list search recent posts

array undefined, but has length?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Donnolio
array undefined, but has length?
on May 29, 2007 at 3:56:31 pm

code snippet:

if(myVar < Admin.freeAgents.length){
_root.trace("Admin.freeAgents = " + Admin.freeAgents);
_root.trace("Admin.freeAgents.length = " + Admin.freeAgents.length);
...
}

corresponding output:

Admin.freeAgents = undefined
Admin.freeAgents.length = 1

How can this be? Note that for the output to show at all, we have to meet the condition in the if, which compares comparison with Admin.freeAgents.length. How can the array have a valid length, and yet be undefined itself?



Return to posts index

Sher Ali
Re: array undefined, but has length?
on May 29, 2007 at 4:12:34 pm

I don't know how do you get the trace messages?

As the trace is a global function and you are calling it with a _root timeline movieclip.



Return to posts index

Donnolio
Re: array undefined, but has length?
on May 29, 2007 at 6:20:35 pm

Oh, sorry about that. The _root.trace() plugs the trace into a TextArea that I can choose to be visible or not. I can view the SWF in a browser and still be able to view the traces, that's all.
If you'd like, you can just look at it as being a regular trace(); function; it does the same thing as far as output goes.



Return to posts index


Donnolio
Re: array undefined, but has length?
on May 29, 2007 at 6:30:20 pm

Okay...I found the problem. What I was populating it with was from an XMLNode, and I was one child off...so I was populating it with an object that was undefined.



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]