PDA

View Full Version : lztrackservice.lztrackgroup gives a null error?


mico
07-14-2008, 10:04 PM
$4 has no property (null)
"__LZtrackgroup",function($1,$2){
for(var $3=0;$3<$1.length;$3++){
var $4=$1[$3];if($4&&$4.visible){//modified
var $5=$4.getMouse("x");if($5>0&&$5<$4.width){
var $6=$4.getMouse("y");if($6>0&&$6<$4.height){
$2.push($4)
}}}}}

i always see a $4 has no property

"__LZtrack",function($1){
var $2=[];for(var $3 = 0;$3<this.__LZactivegroups.length;$3++){
//for(var $3 in this.__LZactivegroups){//modified from interator to index
var $4=[];var $5=this.__LZactivegroups[$3];if($5){


should functions also be visited in lztrack() ?
after replace the iterator with a loop using index,the error never happens

kampfkolosso
07-14-2008, 10:55 PM
Wow, sorry, not that deep in the issue, but from the code above $1[$3] seems the problem. Since the upper border of $3 is equal to $1's length, that should be fine. But one or more entries are null. Duno what $1 is...

Oh, ok, $1 = array of views (?) in the trackgroup, ey? So one ore more views are null? Maybe function adding, removing views from the trackgroup do nasty ackward stuff!? Just my 2 cents...

mico
07-14-2008, 11:18 PM
Wow, sorry, not that deep in the issue, but from the code above $1[$3] seems the problem. Since the upper border of $3 is equal to $1's length, that should be fine. But one or more entries are null. Duno what $1 is...

Oh, ok, $1 = array of views (?) in the trackgroup, ey? So one ore more views are null? Maybe function adding, removing views from the trackgroup do nasty ackward stuff!? Just my 2 cents...

sorry for my ambiguousness

the fact is that when error happens , $1 is a function and $1.length is the length of his arguments so function($1,$2){}.length=2

so ,whether the "in" used in LZtrack() is approperiate?

senshi
07-15-2008, 05:02 AM
You're extending "Array.prototype" somewhere, right?

mico
07-15-2008, 05:14 AM
i am not quite clear with the reason for this error
i was just guessingwhy a function has been visited in those code

if this.__LZactivegroups is an array
then all items and swap() will be visited via "in"

senshi
07-15-2008, 05:37 AM
It's just the same as in this post (http://forum.openlaszlo.org/showthread.php?t=12085&p=39039): for-in loop used for Arrays + "extended Array" (functions have been added to Array.prototype).