Skip to main content
Inspiring
June 23, 2014
Question

put a “back” button in front on an embed map

  • June 23, 2014
  • 1 reply
  • 196 views

Hi all,

I've integrate a map from MapQuest in my Adobe Air app (in AS3).

The map is taking all the screen, as I want.

BUT, I'd like to add a "back" button in order to go back to the previous menu.

Here's my code :

var NoumeaNord:TileMap = new TileMap("KEYcode");

            //set the size of the map

            NoumeaNord.size = new Size(800, 533);

            //add the map to the sprite.

            addChild(NoumeaNord);

              NoumeaNord.addControl(new SMLargeZoomControl());

              NoumeaNord.addControl(new MouseWheelZoomControl());

              NoumeaNord.addShape(new Poi(new      LatLng(-22.2758000,166.4580000)));

              NoumeaNord.setCenter(new LatLng(-22.2758000,166.4580000),15);

         function addBackBtn():void{

            var back:MovieClip;

                    back = new backBtn

            addChild(back);

            back.x = 0;

            back.y = 400;

            setChildIndex(back,0);

}

Don't know why but the BackBtn won't be in front of the map ! I've tried with setChildIndex(back,-1); but it makes an error : "RangeError: Error #2006: index is off limit".

Any idea ?

This topic has been closed for replies.

1 reply

Inspiring
June 23, 2014

try

setChildIndex(back,this.numChildren-1);