Okay, I got it to work. The second argument is for attributes, while the third 
is for the style object,
This line works:
               polygon1 = new OpenLayers.Feature.Vector(lines, 
{},{strokeWidth:1, 'strokeColor': 'red'});

From: Robert Sanson [mailto:[email protected]]
Sent: Wednesday, June 29, 2011 3:48 PM
To: [email protected]; JK Chen
Subject: Re: [OpenLayers-Users] can't style a feature .... please help

Try something like:

var style1 = new OpenLayers.style({strokeWidth:5, 'strokeColor': '#ff0000'});
polygon1 = new OpenLayers.Feature.Vector(lines, style:style1);

regards,

Robert

>>> JK Chen <[email protected]<mailto:[email protected]>> 30/06/2011 9:27 
>>> a.m. >>>
Hi,
I am trying to style individual feature with OpenLayers.Feature.Vector 
statement, as this:

                              .
                              lines = new 
OpenLayers.Geometry.LineString([p1,p2, p3, p4, p1]);
                              polygon1 = new OpenLayers.Feature.Vector(lines, 
{strokeWidth:5, 'strokeColor': '#ff0000'});
However, it's not working for me.
Is there anything missing?
Thanks.
JK


Click here<https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==> to report 
this email as spam.


This email and any attachments are confidential and intended solely for the 
addressee(s). If you are not the intended recipient, please notify us 
immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted 
Security. www.websense.com<http://www.websense.com/>
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to