Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel
Accepted Solution

Map confusion:

Hi all,

 

i am stuck and confused as well.Actually i am implementing a location finder app.where i am using Mapquest  .swc file.and my problem is when i am testing that app in simulator its  not showing proper value for any place of Asia.but i have to show all country of asia and distances between 2 given places.

 

So,my question is :is it my coding error or something else?if  tested in real device will it show proper values and places as well?

 

Plz reply.its urgent...

d.dev
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Map confusion:

If you are using their POI dataset, you have to set the data source to Asia (forget what the id is) and you have to have access to that data set. Most dev keys will have it set, but there are some datasets that you need to request access.
Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel

Re: Map confusion:

[ Edited ]

How to set it?i cant locate POI dataset. i am using following code.that is available in TOUR DE FLEX

 

private function onCC():void {
                //add map controls
                this.map.addControl(new SMLargeZoomControl());
                this.map.addControl(new SMViewControl());
                this.map.addControl(new MouseWheelZoomControl());
                
                //make a new directions object
                this.dir = new Directions(this.map.tileMap);
                
                // call function to add event listeners for directions object
                this.addDirectionsListeners();        
                
                _width = FlexGlobals.topLevelApplication.width;
                _height = FlexGlobals.topLevelApplication.height;
                
                /* trace("_width"+_width);
                trace("_height=========="+_height); */
            }
            
            
            /*
            function to add event listeners for directions object
            */
            private function addDirectionsListeners():void {
                //event listener to handle successful directions result
                this.dir.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS,this.onRouteSuccess);
                //event listener to handle erroe in directions result
                this.dir.addEventListener(DirectionsEvent.DIRECTIONS_ERROR,this.onRouteError);
                //event listener to handle ambiguous location in directions result
                this.dir.addEventListener(DirectionsEvent.DIRECTIONS_AMBIGUITY,this.onRouteAmbiguity);
                //event listener to handle io error for directions call
                this.dir.addEventListener(DirectionsEvent.DIRECTIONS_IOERROR,this.onRouteIOError);               
            }
            
            
            
            /*
            called when the "Get Route" button is clicked
            prepares addresses routing & makes the routing call
            */
            private function doRoute():void {
                //remove any existing locations
                if (this.dir) this.dir.locations = null;
                
                //clean the array list
                this.alResults = new ArrayList();
                
                //hide the results
                this.vgrpResults.visible = false;
                
                //cretae the locations array onto which the addresses will be pushed
                this.arrLocations = new Array();
                
                //push the from address onto the array
                this.arrLocations.push(this.txtFrom.text);
                
                //push the from address onto the array
                this.arrLocations.push(this.txtTo.text);
                
                //assign the array to the directions object's locations
                this.dir.locations = this.arrLocations;
                
                //set the busy cursor
                this.cursorManager.setBusyCursor();
                
                //make the routing call
                this.dir.route();
            }
            
            
            /*
            function to handle a successful route result
            */    
            private function onRouteSuccess(e:DirectionsEvent):void {
                this.cursorManager.removeBusyCursor();
                if (e.routeType != "routeShape") {
                    this.makeDirectionsList(e.xml);
                }
            }
            
            
            /*
            function to handle an ambiguity in the routeresult
            */
            private function onRouteAmbiguity(e:DirectionsEvent):void {
                this.cursorManager.removeBusyCursor();
                this.makeErrorList(e.collectionsXml.toString());
            }
            
            
            /*
            function to handle an ioerror
            */
            private function onRouteIOError(e:DirectionsEvent):void {
                this.cursorManager.removeBusyCursor();
                this.makeErrorList("DIRECTIONS IO ERROR");
            }
            
            
            /*
            function to handle an error in the result
            */
            private function onRouteError(e:DirectionsEvent):void {
                this.cursorManager.removeBusyCursor();
                this.makeErrorList("DIRECTIONS ERROR");
            }
            
            
            
            /*
            function to make an array list to hold an error
            */
            private function makeErrorList(s:String):void {
                var o:Object = new Object();
                o.Maneuver = s;
                o.Distance = "";
                o.Time= "";
                this.alResults.addItem(o);
                
                this.dgResults.dataProvider = this.alResults;
                this.vgrpResults.visible = true;
            }
            
            
            
            /*
            function to handle creating the arraylist for a successful route result and
            displaying it in the list control
            */
            private function makeDirectionsList(x:XML):void {
                var s:String = "";
                var legs:XMLList = x.route.legs.leg;
                var maneuvers:XMLList;
                var maneuver:XMLList;
                var dirCount:int = 1;
                
                for (var i:int = 0; i < legs.length(); i++) {
                    maneuvers = legs[i].maneuvers;
                    
                    for (var j:int = 0; j < maneuvers.length(); j++) {
                        maneuver = maneuvers[j].maneuver;
                        
                        for (var k:int = 0; k < maneuver.length(); k++) {                            
                            s = dirCount + ". " + maneuver[k].narrative.text();
                            
                            var o:Object = new Object();
                            o.Maneuver = s;
                            o.Distance = Number(maneuver[k].distance.text()).toFixed(2) + " mi";
                            o.Time = maneuver[k].formattedTime.text();
                            
                            this.alResults.addItem(o);
                            
                            dirCount ++;
                        }
                    }
                }
                
                
                this.lblTime.text = "Total Time:  " + x.route.formattedTime.text();
                this.lblDistance.text = "Total Distance:  " + Number(x.route.distance.text()).toFixed(2);
                
                this.dgResults.dataProvider = this.alResults;
                this.vgrpResults.visible = true;
            }

 

d.dev
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Map confusion:

This codes looks like you are doing routing. I am not seeing anything related to POIs. If I miss understood your question and you are getting errors from the route not being found, it is probably because the data is incomplete in OSM. Goto the MapQuest OSM editor and look at the data to see if roads are not connected or one-way roads are the wrong way.
Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel

Re: Map confusion:

[ Edited ]

i m really confused!!cant understand wat to do.how to find out all the datas?can u plz help me out?when i open the map to get direction in mapquest its showing.

d.dev
Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel

Re: Map confusion:

Follwed this link --http://www.igorcosta.org/?p=350&cpage=1#comment-275470

N problem is solved...

d.dev
Please use plain text.