Hi Eduardo, thanks for your help! Ive implimented this into my code but still 
does not work, i now get a couple of errors...

Desc: 1061: Call to a possibly undefined method addEventListener through a 
reference with static type Class.
Src: main_site.addEventListener("bk2globe", bk2globeListener);

Desc: 1061: Call to a possibly undefined method addEventListener through a 
reference with static type Class.
Src: main_site.addEventListener("randomImg", randomImgListener);

here is my code

* * * * * * * * * *
main_site.as
     dispatchEvent(new Event("bk2globe"));
     dispatchEvent(new Event("randomImg"));

* * * * * * * * * *

gallery.as
main_site.addEventListener("bk2globe", bk2globeListener);
main_site.addEventListener("randomImg", randomImgListener);

  private function bk2globeListener(ev:Event):void
  {
   goBackToMain();
  }
  private function randomImgListener(ev:Event):void
  {
   loadPhoto(randRange(1, 52));
  }

* * * * * * * * * *

Thanks
SJM
  ----- Original Message ----- 
  From: Eduardo Omine 
  To: Flash Coders List 
  Sent: Wednesday, August 13, 2008 6:19 PM
  Subject: Re: [Flashcoders] AS3 accessing functions from other classes


  Dispatch an event from the loaded SWF and let the parent SWF handle the 
action.

  * * * * * * * * * *
  MainSite.as
  dispatchEvent(new Event("myEventName"));

  * * * * * * * * * *

  Gallery.as
  mainSite.addEventListener("myEventName", myListener);

  private function myListener(e:Event):void
  {
  // call desired method here
  }

  * * * * * * * * * *

  HTH

  -- 
  Eduardo Omine
  http://blog.omine.net/
  http://www.omine.net/
  _______________________________________________
  Flashcoders mailing list
  [email protected]
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to