Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 92756

Geolocation Disable produces Error #1009: Cannot access a property or method...

$
0
0

Hello,

I am trying to disable the Geolocation detector upon leaving a frame.

I added a REMOVED_FROM_STAGE event that is working, but will not disable the Geo polling in later frames.

When I add a "null;", as listed below, I get the #1009 error.

Any idea why this is happening?

 

Thank you,

__________________________________

 

 

 

stop();

  import flash.display.MovieClip;

  import flash.sensors.Geolocation;

  import flash.events.GeolocationEvent;

  import flash.events.StatusEvent;

  import flash.events.MouseEvent;

  import flash.net.URLRequest;

  import flash.events.Event;

  import flash.events.IOErrorEvent;

  import flash.errors.IOError;

  import flash.display.Loader;

 

var geo:Geolocation;

var loader:Loader;

 

camera1.addEventListener(Event.REMOVED_FROM_STAGE,removedF);

 

function removedF(e:Event):void{

geo.removeEventListener(GeolocationEvent.UPDATE, updateHandler);

geo.removeEventListener(GeolocationEvent.UPDATE, geolocationStatus);

geo = null;

removeEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

removeEventListener(Event.ENTER_FRAME, geostart);

removeEventListener(Event.REMOVED_FROM_STAGE,removedF);

}

 

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

 

function fl_EnterFrameHandler(event:Event):void

{

  if (Geolocation.isSupported)

  {

  geo = new Geolocation();

  geo.addEventListener(StatusEvent.STATUS, geolocationStatus);

  }

  else

  {

  }

  }

 

 

addEventListener(Event.ENTER_FRAME, geostart);

 

  function geostart(event:Event):void

  {

  geo.addEventListener(GeolocationEvent.UPDATE, updateHandler);

  }

 

 

function geolocationStatus( e :StatusEvent ):void

  {

  if (e.code == "Geolocation.Unmuted")

  {

  loadMap();

  }

  else

  {

  }

  }

 

 

function updateHandler(event:GeolocationEvent):void

  {

  loadMap(event.latitude.toString(), event.longitude.toString());

  geo.removeEventListener(GeolocationEvent.UPDATE, updateHandler);

  }

 

function loadMap(lat:String=null, long:String=null):void

  {

  var locString:String;

  var markers: String;

 

  if(lat != null)

  {

  if ( Number(lat)>39.13 && Number(lat)<39.19 && Number(long)> -86.59 && Number(long)< -86.55 ){

 

  gotoAndStop(21);

                      }

  else {

  gotoAndStop(20);

 

  }

 

  } else {

  gotoAndStop(20);

 

  }

 

  }


Viewing all articles
Browse latest Browse all 92756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>