2 Replies Latest reply on Dec 12, 2009 5:40 PM by laxmidi

    Achtung Nerdlings, Need Help with Error 1061

    laxmidi

      Hi,

       

      I can't figure out why I'm getting the following error:

           1061: Call to a possibly undefined method getAdReturn through a reference with a static type Class
      Any suggestions?
      I've highlighted the line on which I get the error:

      import flash.net.navigateToURL;

      import com.joeblow.ads.Ad;

      import com. joeblow.ads.OpenAds;

       

      private var _adReturn:Ad;

       

      private function initAd():void {

      _adReturn = OpenAds.getAdReturn();

      adImage.source = _adReturn.mediaSource;

      adImage.buttonMode = true;

      adImage.addEventListener(MouseEvent.CLICK, sendToURL);

      }

       

       

       

       

       

       

      The class is as follows:

       

       

       

       

      package com.joeblow.ads

      {

      import flash.external.ExternalInterface;

      import mx.controls.Alert;

       

       

      public class OpenAds {

       

      private static var externalCallback:String = "callOpenAds";

      private static var retries:uint = 10;

       

      public function OpenAds(){

       

      }

       

      public function getAdReturn():Ad {

      var xmlReturn:XML;

      if(ExternalInterface.available) {

      var adReturn:String = ExternalInterface.call(externalCallback);

       

      try

       

      {

      adReturn = adReturn.replace("//]]>->","//]]>->\n");

      var infoTagsIndex:int = adReturn.indexOf('<script type="text/javascript" src=""', 0);

      adReturn = adReturn.substring(infoTagsIndex, adReturn.length);

      var wasFlash:Boolean = false;

      if(adReturn.search("<embed") == -1) {

      adReturn = adReturn.replace('></a>', '></img></a>');

      adReturn = adReturn.replace('></div>', '></img></div>');

      }

      else {

      adReturn = adReturn.replace('></div>\n<script','></embed></div>\n<script');

      adReturn = adReturn.replace('></div>\n<noscript','></img></div>\n<noscript');

      wasFlash = true;

      }

       

      adReturn = '<adXMLReturn>' + adReturn + '</adXMLReturn>';

      xmlReturn = new XML(adReturn);

       

      var ad:Ad;

       

      if(wasFlash){

      ad = new Ad(xmlReturn, true);

      }

      else {

      ad = new Ad(xmlReturn);

      }

      }

      catch(error:Error){

      Alert.show(error.message + 'stacktrace:' + error.getStackTrace(), "Error");

      }

      }

      else {

      Alert.show("Javascript must be enabled to view this page properly.", "Javascript Not Detected");

      xmlReturn = new XML('<root>xml</root>');

      }

      return ad;

      }

       

      }

       

       

       

      }

       

       

      If you can help me, I'd really appreciate it!!

       

      Thanks,

      -Laxmidi