my all earlier questions made clear... plz help
let me make things clear. after lot of debugging and tracing i found my actual problem.
i get a location point using
locPoint = map.locationPoint(myLocation,polySprite);
trace(locPoint.x+","+locPoint.y); ///output(300,200)
now i pan the map either by dragging or using panTo() function so that marker in myLocation moves to new position in the screen. then i repeat the code by adding it in function "onMapStopPan(event:MapEvent):void" which is called when the map gets a stop panning event.
locPoint = map.locationPoint(myLocation,polySprite);
trace(locPoint.x+","+locPoint.y); ///again output(300,200)
shouldn't new locPoint.x and locPoint.y change.
i want updated points so that i accordingly pan my map and stop it from panning. am i doin something wrong in the code or my whole approach is wrong. please help me (with code if possible)
i know i have filled up ur space with similar type of questions. sorry for that but a reply to this questions should solve all my earlier posts.
please help....
i get a location point using
locPoint = map.locationPoint(myLocation,polySprite);
trace(locPoint.x+","+locPoint.y); ///output(300,200)
now i pan the map either by dragging or using panTo() function so that marker in myLocation moves to new position in the screen. then i repeat the code by adding it in function "onMapStopPan(event:MapEvent):void" which is called when the map gets a stop panning event.
locPoint = map.locationPoint(myLocation,polySprite);
trace(locPoint.x+","+locPoint.y); ///again output(300,200)
shouldn't new locPoint.x and locPoint.y change.
i want updated points so that i accordingly pan my map and stop it from panning. am i doin something wrong in the code or my whole approach is wrong. please help me (with code if possible)
i know i have filled up ur space with similar type of questions. sorry for that but a reply to this questions should solve all my earlier posts.
please help....
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?I believe the xy co-ordinates returned by locationPoint are relative to the context in the method, the second parameter. If polySprite is moving when the map pans then the x, y values may not change.
Should the context be the map, or the map's parent? -
Inappropriate?all i m using is the sample code for flash AS3 that came with modest map. the code is long so i hesitate posting it in this section. i have made no changes to the code and with the amount of knowledge i have in AS3 i dont think my polySprite is moving.
i had been lookin for a reply impatiently since i posted the question and u appeared as a god to me. please make the explation in a bit clearer word if it was somethin different u were askin with me. plz help . really need it......
I’m sad
-
Inappropriate?Perhaps you could explain what polySprite is, what it is a child of and why you want the x,y co-ordinates (what you are going to do with them)?
-
Inappropriate?ok polySprite is just a sprite that is added as a child of map component. i want to draw lines in the polySprite i.e trace paths on map according to the location i get from a GPS receiver. the data i would get would be in real time. now the problem i got was when the location started somewhere in the center but later moved to a location that is not shown in the screen. in this case i want to pan the map so that the new location point appears on the screen and once the location is visible i want to stop the panning. i think i made it clear. if not please tell me where should i post my code but the problem is my code is very jumbled and i fear i would confuse you more.
now i realize that the lines i draw moved too that means my polySprite is also moving. what should i do to find out that my new location is in screen so that i can stop panning. or how can i get the new screen pixel position of the location after panning.
lookin forward for your suggestions....
I’m sad
-
Inappropriate?If your polySprite is moving when the map is panned then locationPoint should return the same result before and after pan since the location is at the same place relative to the sprite.
When you get a new location from your GPS device then you are panning to it and then using locationPoint for the point, relative to polySprite, of the new location. This should allow polySprite to draw to the new location.
I'm not sure why you need to "stop panning" using the screen co-ordinates, I would have thought just re-centering the map using a location would be sufficient? -
Inappropriate?that is what i m tryin but to check if the location is in the screen i am using this code
myLocPoint = myMap.locationPoint(<new>,polySprite);
if(myLocpoint.y<-600><new>,true);
}
the above code gets checked every time i need to plot as y-coordinate goes out of bound my map pans but still the y-coordinate continues to be <-600></new></new>
I’m sad
-
Inappropriate?To tell if a location is visible or not you could either:
- Use getExtent() for the map and see if your location is in the extent (probably preferred) or
- Get the screen co-ords RELATIVE TO THE MAP (not the polySprite) and compare that to the map's top/left and width/height
-
Inappropriate?I think Richard may be onto something - it sounds like polySprite is moving. You say it's a Sprite, but that you're using Modest Maps sample code. If polySprite is a MarkerClip, or an Overlay, or if you're using the Polygon example from the Modest Maps wiki, then it might be moving automatically in response to MapEvent.PANNED.
This forum isn't the best place to post lots of source code, but Flex Builder makes it really easy to publish source code of AS3 as well as swf files, using the ViewSource class:
ViewSource.addMenuItem(this, 'srcview/index.html', true);
Can you export a release build of your app, with source, and post it somewhere so we can see what's up? If you don't want to make your actual app public for some reason, can you make a demo app? -
Inappropriate?i dont have any idea related to FLEX and my project is in flash. please if possible give me some email add so i can send my source file, my AS3 codes and swf release. i also dont have my own website to upload and send you a link. and yes i am using Polygon example from MOdest Map wiki.
Loading Profile...




EMPLOYEE