http://developer.mapquest.com/web/guest
MapQuest Developer Network
  • Sign In  |
  • Create Account  |
  • Contact Us
  •   |
  • Quick Start  |
    For Businesses For Developers For Easy Mapping Tools Get MapQuest AppKey
  • Business Solutions  |
    Enterprise Solutions Business Listings
  • APIs  |
    Licensed Data APIs Open Data APIs Licensed vs. Open Data
  • Mapping Tools  |
    Overview Map Builder Route Planner Link to MapQuest Link to Route Planner Distance Calculator Latitude/Longitude Finder Static Map Wizard
  • Resources  |
    Licensed vs. Open Data Developer Guides Terms Overview Terms of Use
  • Blog  |
    MapQuest Developer Blog MapQuest Blog
  • Support
    FAQ Forums Contact
Answer ( Unmark )
Mark as an Answer

Toggle ShapeCollection

Forums

» SDKs - Flash Maps API » Toggle ShapeCollection
Combination View Flat View Tree View
Threads [ Previous | Next ]
Don Kerr
Don Kerr Rank: Padawan Posts: 41
Join Date: 7/19/11

Recent Posts
Toggle ShapeCollection
Answer (Unmark)
3/8/12 10:26 AM
I have 3 ShapeCollections on the map. One I want to stay there all the time. The other two I want to toggle on/off.

after removing the shapecollection the first time, map.addShapeCollection(myShapeColl) adds it to the map again (in debug variables), but the collection is not visible on the map. How do I make it show up again?

I don't want to call map.removeShapes() at the start of the toggle because I don't want it to remove my poi markers each time the other shapecollections are toggled.

Here is the toggle code I'm using below. Any ideas?

Thanks,
Don


private function toggleKML():void {
//map.removeShapes();
if (btnKML.label == "Show Areas") {


if(myKMLColl){
myShapeColl = new ShapeCollection();
myShapeColl = myKMLColl;
map.addShapeCollection(myShapeColl);
btnKML.label = "Hide Areas";
}

else {

createKML();
}



}
else {
//remove the remote collection

map.removeShapeCollection(myShapeColl);

btnKML.label = "Show Areas";
}
}


private function toggleKML_LAB():void {
//map.removeShapes();
if (btnKML_LAB.label == "Show Area Names") {

if(myKMLColl_LAemoticon{
map.removeShapeCollection(myShapeColl_LAemoticon;
myShapeColl_LAB = new ShapeCollection();
myShapeColl_LAB = myKMLColl_LAB;
map.addShapeCollection(myShapeColl_LAemoticon;
btnKML_LAB.label = "Hide Area Names";

}
else {
createKML_LAB();
}


}
else {
//remove the remote collection

map.removeShapeCollection(myShapeColl_LAemoticon;
btnKML_LAB.label = "Show Area Names";
}
}
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
  • Top
Don Kerr
Don Kerr Rank: Padawan Posts: 41
Join Date: 7/19/11

Recent Posts
RE: Toggle ShapeCollection
Answer (Unmark)
3/8/12 10:34 AM as a reply to Don Kerr.
Also, if both Areas and Area Names SCs are visible, when I turn off Area Names, it also removes Areas. There isn't any code that would remove both, so it is very strange.
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
  • Top
Darin Weakley
Darin Weakley Rank: Sith Lord Posts: 391
Join Date: 11/3/09

Recent Posts
RE: Toggle ShapeCollection
Answer (Unmark)
3/8/12 10:52 AM as a reply to Don Kerr.
See if THIS is what you're after.
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
  • Top
Don Kerr
Don Kerr Rank: Padawan Posts: 41
Join Date: 7/19/11

Recent Posts
RE: Toggle ShapeCollection
Answer (Unmark)
3/8/12 11:05 AM as a reply to Darin Weakley.
Similar yes. But the add/remove ShapeCollection process is the same as what I'm using, except mine is behaving strange. Could it be because I'm using mobile? I'm sure it is my code. Just can't see what I'm doing wrong. The shapes are on the map when I expand them in the variables view, they are just not visible.
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
  • Top
Don Kerr
Don Kerr Rank: Padawan Posts: 41
Join Date: 7/19/11

Recent Posts
RE: Toggle ShapeCollection
Answer (Unmark)
3/8/12 1:10 PM as a reply to Don Kerr.
I combined the two toggles into one. It doesn't seem to like adding/removing two shape collections or at least how my code was doing it.

I'm ok for now with this workaround.

Thanks Darin

Don
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
  • Top
Platforms & Technologies
Quick Start for Developers
Quick Start for Easy Mapping Tools
Licensed Data APIs
Open Data APIs
Popular Products
JavaScript Maps API
Flex Map API
Geocoding API Web Service
Directions API Web Service
Search API Web Service
Support
Licensing
Developer Forums
Contact Us
FAQ
Products
MapQuest.com
Mobile Products
Route Planner
Gas Prices
Follow MapQuest
MapQuest Developer Blog
MapQuest Blog
MapQuest on Facebook
MapQuest on Twitter
Join our Mailing List

©2012 MapQuest, Inc. All rights reserved.    Privacy Policy | Terms of Use

Site Map | Help

Loading......