thanks, Andrews. let me see if I understand...

> Your startAnimation function reads through a line called "poly" (if
> I've understood it right).

this is the poly = new GPolyline(pts,'#FF0000',0,0); at the end of the
xml, I guess

>
> Change that to polys[lineNumber] so that it uses one of the lines you
> have in the array, assuming you called it "polys" as suggested.

ok - so I changed it to gpolys[poly_num] = new GPolyline(pts,'#FF0000',
0,0);

because I have the lines:
gpolys.push(poly);
        var poly_num = gpolys.length - 1;

which get the line number from the array.

It may be referenced in several places.

It is - and I'm assuming that all the code like:
var p0 = poly.getVertex(0);

needs to be changed to
var p0 = gpolys[poly_num].getVertex(0);


> Change the function definition to include that lineNumber --
>   function startAnimation(lineNumber) {

I'm thinking that the line number gets passed to the function
definition like this:
function startAnimation(poly_num)

>
> Change where that is called to include the number of the line you want
> to follow, like startAnimation(0) or startAnimation(1). You'll
> probably use a variable there --
>   var lineToFollow = 0; // assigned however you do this
>   startAnimation(lineToFollow);

and the function that calls the startAnimation function calls it like
this:
function toggleRun(poly_num){
 var btn = document.getElementById(poly_num);
  if (document.getElementById(poly_num).onclick) {
  if (run,poly_num){
                run=false;
                startAnimation(poly_num);
        }
}
}

so I guess I'm ok there, too

> Then when you call the animation on line 2 (say), 2 gets passed into
> the function which then follows polys[2].

should do. but there are a couple of snags. This line, from the old
code:
gpolys.push(poly);

doesn't push onto anything, now that "poly" doesn't exist... but doing
gpolys.push(gpolys[poly_num]); is of course just weird and wrong and
doing gpolys.push(line); gets me a "line is undefined" error.

and when I try it all out without changing the push line), there's a
"Cannot read property 'xa' of undefined" error...

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to