> In case you're interested, there's a stripped-down version of the map
> here, with the irrelevant code bits
> deleted:http://www.xelawho.com/map/arrow2.htm
Have a look at the code that crates the arrowheads:
midLineArrows() is the main function, and accepts one argument 'pts'
midLineArrows() calls in turn createArrow() to create each of the
arrowheads.
midLineArrows() calls createArrow() giving just two arguments - 'p3'
and 'arrowIcon'
createArrow() accepts three arguments - point, icon, category
If createArrow() were supplied a third argument, it would use that to
assign the 'mycategory' property of each arrowhead created.
But it isn't supplied a third argument, so 'mycategory' stays
undefined.
So, you need to change the call inside midLineArrows() to give that
third argument, something like
createArrow(p3, arrowIcon, rhubarb);
Then whatever value 'rhubarb' has will get used to give the arrowheads
a 'mycategory'.
Next, how are you going to put the value you want into 'rhubarb' ?
midLineArrows() doesn't know what category the polyline it is working
on has, no-one told it.
So you need to tell it ... probably by passing the information in as
an argument.
Alter midLineArrows() definition to accept a second argument
function midLineArrows(pts , rhubarb) {
Now you can pass something in and have it passed on to createArrow()
in turn.
But, how are you going to pass a useful something to midLineArrows() ?
In your main XML processing code, just after you create the line you
both call midLineArrows() and assign a category to the line.
var poly = new GPolyline( ... );
midLineArrows(pts)
poly.mycategory = category;
All you need to do is see that 'category' gets passed on as well
midLineArrows(pts, category) ;
And while you'e there fix the missing semicolon at the end, not all
browsers will forgive the omission.
--
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.