Global app variable with dynamic properties

You must Login before you can answer or comment on any questions.

I have a Map View on 3 different windows. They all use the same script to create and display the map. The problem is that they are all using the same App variable Ti.App.mapview.

I've been trying to create something like Ti.App.mapview.thisWindow (thisWindow being a string passed to distinguish the window) and getting them seperated out.

Is there an easy way to do this?

— asked 7 months ago by Adam Zwakenberg
2 Comments
  • Put some code snippet here to help and understand better.

    — commented 7 months ago by Ashish Nigam

  • function Map(thistype){
        var mapWindow = Ti.UI.createWindow({
            backgroundColor:'black',
            zIndex:2
        });
        Ti.App.mapview[thistype] = Ti.Map.createView({mapType: Ti.Map.STANDARD_TYPE,region: {latitude:33.74511, longitude:-84.38993, latitudeDelta:8, longitudeDelta:8},regionFit:true,animate:true});
        mapWindow.add(Ti.App.mapview);
        return mapWindow;
    Say I have a function like this, I want the MapView App var to be generated with the "thistype" variable

    — commented 7 months ago by Adam Zwakenberg

1 Answer

You're going to want to read the MapView docs before you go down this path. Android only supports one mapview.

— answered 7 months ago by Shannon Hicks
answer permalink
2 Comments
  • I'm not using Andriod, I'm using iOS

    — commented 7 months ago by Adam Zwakenberg

  • In that case, please read the "Ask your own question" link in the right-hand column, and provide us details that we need to properly answer the question.

    — commented 7 months ago by Shannon Hicks

Your Answer

Think you can help? Login to answer this question!