2 Replies Latest reply on Sep 18, 2007 12:11 PM by Newsgroup_User

    clickTag and AS3 code c heck please

    Ofeargall Level 1
      I'm new to Flash and Action Script. I'm creating a banner ad for a clent for the first time. I've created a transparent MovieClip covering the stage called clickthrough_mc. The agency wants a clickTag added. Here's the code I've added to the actions layer. Can someone proof it for me and let me know if I'm doing this right?

      on(release)
      {
      getURL (_level0.clickTag, "_blank");
      }

      clickthrough_mc.buttonMode = true

      I get errors but I assume that is because my code is calling for something that doesn't exist yet because the swf isn't uploaded to the host site, correct?

      Here's the error codes.

      1180: Call to a possibly undefined method on.
        • 1. Re: clickTag and AS3 code c heck please
          Level 7
          Set the publish settings to Actionscript 2 instead of 3.

          Or ask for up to date documentation for actionscript 3, your client
          should be able to provide it if it's there. I kind of doubt it will be
          though, most banners don't need AS3 functionality, I suppose they won't
          bother.

          HTH,
          Manno


          Ofeargall wrote:
          > I'm new to Flash and Action Script. I'm creating a banner ad for a clent for
          > the first time. I've created a transparent MovieClip covering the stage called
          > clickthrough_mc. The agency wants a clickTag added. Here's the code I've added
          > to the actions layer. Can someone proof it for me and let me know if I'm doing
          > this right?
          >
          > on(release)
          > {
          > getURL (_level0.clickTag, "_blank");
          > }
          >
          > clickthrough_mc.buttonMode = true
          >
          > I get errors but I assume that is because my code is calling for something
          > that doesn't exist yet because the swf isn't uploaded to the host site, correct?
          >
          > Here's the error codes.
          >
          > 1180: Call to a possibly undefined method on.
          >


          --
          ----------
          Manno Bult
          http://www.aloft.nl
          • 2. Re: clickTag and AS3 code c heck please
            SymTsb Level 2
            This is invalid code for AS3. Your code above is for AS2. The on method was deprecated in AS3 and a new event model replaced the old style of events.


            // AS3 Code
            // Assumes that clickTag is a URL to whatever page you want to go to...

            var clickTag:String = " http://www.mysite.com/";

            clickthrough_mc.addEventListener( MouseEvent.CLICK, handleClick );
            clickthrough_mc.buttonMode = true;
            function handleClick( e:MouseEvent ):void{
            navigateToURL( new URLRequest( clickTag ) );
            }