Hi Robert, Thanks for your reply. I have made sure that I add a spatial reference to the points. I also realised they were points and not MapPoints so I have changed them to mappoints.here is my code (code snips are edited down to keep this post simple)
private function createFFAFiringPoint():Array
{
var point:MapPoint;
var i:int;
var common:CommonRoutines = new CommonRoutines();
var spatRef:SpatialReference = new SpatialReference(27700);
try
{
//plot a standard trace
//first of all adjust the left and right of arc figures to cater for aim error and run through the routine that ensures bearings
//are kept within the range of 6400mils (360 degs).
arcLeft = common.MODO((arcLeft - aimError), 6400);
arcRight = common.MODO((arcRight + aimError), 6400);
//calculate points on polygon to generate trace shape (there are always 6 points excluding firing position on standard ffa trace)
//we can't do a simple loop because although the method of calculating the point is always the same, the values we pass to the method
//vary depending on which point of the polygon we need to calculate:
//plot origin and push to array
point = new MapPoint(firingPosX, firingPosY, spatRef);
arrPoints = new Array;
arrPoints.push(point);
//Point 1
point = common.CalculatePoint((stdTraceWidth * -1), common.Distance1(stdTraceWidth), arcLeft, firingPosX, firingPosY);
[etc.....]
return arrPoints;
calculate point code:
public function CalculatePoint(piWidth:Number, piDistance:Number, piArc:Number, firingPointX:Number, firingPointY:Number):MapPoint
{
var direction:Number;
var targetBearing:Number;
var distance:Number;
var xValue:Number;
var yValue:Number;
var spatRef:SpatialReference = new SpatialReference(27700);
try
{
//Flex uses radians to calculate angles, user entered details in mils.
direction = milsToRads(piArc);
//make adjustments for targetBearing in different quadrants of an x/y grid.
targetBearing = adjustAngleForQuadrant(piWidth, piDistance) + direction;
//basic trig: the hypotonuse length = sqrt of the sum of the squares of the other 2 sides
distance = Math.sqrt((piWidth * piWidth) + (piDistance * piDistance))
//create the co-ordinates for the newly calculated point
xValue = Math.sin(targetBearing) * distance + firingPointX;
yValue = Math.cos(targetBearing) * distance + firingPointY;
//nb some extra code may need to be added later if we start to deal with non Uk maps to determine which
//spatial reference to use
myPoint = new MapPoint(xValue,yValue, spatRef);
[etc]
return myPoint;
I also ensured that the polygon was spatially referenced as well:
var spatRef:SpatialReference = new SpatialReference(27700);
var newTrace:Polygon = new Polygon();
newTrace = FPClass.PlotTrace()
newTrace.spatialReference = spatRef;
graphic = new Graphic(newTrace, s_lineSymbol);
gfxTemplates.add(graphic);
however I am still having no luck....Could the problem be the symbol declaration?
<esri:SimpleLineSymbol id="s_lineSymbol" color="0xFF000" width="3" alpha="0.5"/>
I have also upgraded to the 3.5 sdk from adobe (was on 3.2 before). If you or anyone else has any other ideas I'd love to hear them!