(Map) Runtime markers

I'm trying to change marker.imageasset when a user clicks on a marker. I want to show a photo of fish caught at that particular lat/long. I also want to close marker after a few seconds and change marker back to original image. I can dynamically change marker image, but want to show fish image on click for only a few seconds. So I'm looking for a delay procedure. AI2 doesn't have a good way to do this. Any suggestions would be appreciated.


have a clock increment a variable X by .01 every .01 secs and when it reaches 3 or above run your code. or whatever timings work for you

Here's a sample app with timer, but repeating.
For non-repeating, don't set the next future deadline after the current deadline is reached.

This is not complicated as others suggest Mark. Blocks similar to the following snippet should work. The snipped has to be adapted to your programming.

is produced with code like this


Click on a green runtime Marker, the customMarker appears and a larger sized image. Both images display for 20 seconds using a Clock initially in a TimerEnabled state of false and a TimeInterval of 20000 ms (20 seconds). Clicking the green icon displays the images for 20 seconds. A delay procedure is not required.

You have to photograph and catch your fish yourself. Provide appropriate code to make a reduced size image of your fish (for your customMarker). The customMarker image wont scale, you have to provide a copy of the image right sized. Perhaps display a 'full' size image if you want as shown in the example. The images in my example are stored in Media.

Experiment and try some Blocks. What you do depends on how you handle your List of image components (called newMarker in this simple example). If you have issues, share your Blocks and someone might have advice.

This approach works with design time Markers. The same effect is easier to achieve using runtime markers.


thank you! I'll let you know how it works out.

Well after some tweaking, I was able to incorporate your delay function into my app. it's working, but the problem now is that I'm using marker.longpress to get image from my Google drive. it take about 5-10 seconds for image to download. so I need to reduce file size. what would you recommend for image resolution? 600x400?


Glad the blocks I recommended solved your basic issue Mark.

I can not recommend anything Mark. You want to reduce the time to retrieve an image file from your Google Drive. The size you intend to display the image, the type of image file (jpg, png, etc), the actual file size affect the download speed. Only you can determine what is appropriate as to HxW of the image. Use the smallest file size you can and your download speed might improve.

I would determine what is optimum by experimentation based on the image size that will be displayed in your app (are you only exporting the image to the CustomImage (perhaps 50 x 50 pixels or so ) or are you also showing a larger image (300 x 300). You only need an image with as much resolution as required to display. I do not know the current size of the images (kb) on your Google Drive and I can't guess. Run a test case and see what happens. You want to reduce the download time and file size. Try something (reduce one or two images in your GoogleDrive to 800x400 or smaller in dimensions). Let us know what changes improves your situation. Experience shows generally png images are smaller and more flexible than jpg or bmp images so you might experiment with file type too.

So...experiment...what happens? :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.