Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4622330
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:49:42+00:00 2026-05-22T02:49:42+00:00

I am trying to add an array of randomly placed markers to a Google

  • 0

I am trying to add an array of randomly placed markers to a Google Map in Flash with the API V3 and AS3.

I can create the markers no problem, but I’m having a bit of trouble putting them into an array and then clearing them afterwards as I need to provide this functionality.

I saw another post where people were talking about the lack of map.clearOverlays(); in V3? and I need a bit of help incorporated my code .

var markers:Array = new Array();

 function addmarkers()
{
    // Add 10 markers to the map at random locations
    var bounds:LatLngBounds = map.getLatLngBounds();
var southWest:LatLng = bounds.getSouthWest();
var northEast:LatLng = bounds.getNorthEast();
var lngSpan:Number = northEast.lng() - southWest.lng();
var latSpan:Number = northEast.lat() - southWest.lat();
for (var i:int = 0; i < 10; i++)
{
    var newLat:Number = southWest.lat() + (latSpan * Math.random());
    var newLng:Number = southWest.lng() + (lngSpan * Math.random());
    var latlng:LatLng = new LatLng(newLat,newLng);
    map.addOverlay(new Marker(latlng));
    markers.push();

}

}

I’ve got a button that calls this but then I also want a button that

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:49:42+00:00Added an answer on May 22, 2026 at 2:49 am

    my working code with yours incorporated, thanks.

    function dorandomPoints(e:MouseEvent):void
    {
    if (chkbox.selected)
    {
    
        var bounds:LatLngBounds = map.getLatLngBounds();
        var southWest:LatLng = bounds.getSouthWest();
        var northEast:LatLng = bounds.getNorthEast();
        var lngSpan:Number = northEast.lng() - southWest.lng();
        var latSpan:Number = northEast.lat() - southWest.lat();
    
    
        for (var i:int = 0; i < 10; i++)
        {
            var newLat:Number = southWest.lat() + (latSpan * Math.random());
            var newLng:Number = southWest.lng() + (lngSpan * Math.random());
            var latlng:LatLng = new LatLng(newLat,newLng);
            var marker:Marker = new Marker(latlng);
            markerArray.push(marker);
            map.addOverlay(markerArray[i]);
            //map.removeOverlay(marker);
            //trace(markerArray.length);
        }
    }
    else
    {
    
    
        while (markerArray.length > 0)
        {
            var m:Marker = markerArray.shift() as Marker;
            map.removeOverlay(m);
            m = null;
        }
    
    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add infoWindow's to multiple markers on a Google Map. The closest
I'm trying to create an array in MIPS Assembly, and then add all the
I am trying to add a JButton Array to my GridLayout but it seems
I am trying add value to a mutlidimensional array but I am slightly confused
Im trying to add elements to a dict list (associative array), but every time
I'm trying to add a filter in AS3/Flex SDK. I can add a filter
Hey guys, I'm trying to add a textfield.text entry to an array. I want
Trying to add an onclick handler to my tabs, and can't seem to get
Im trying to add a directory foo to my repo, but there are some
Im trying to add objects to an array by using push. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.