Groups | Blog | Home
all groups > flash actionscript > september 2007 >

flash actionscript : clickTag and AS3 code c heck please


Ofeargall
9/18/2007 6:18:23 PM
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.
SymTsb
9/18/2007 7:33:26 PM
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 ) );
}
Manno Bult
9/18/2007 9:11:28 PM
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


[quoted text, click to view]


--
----------
Manno Bult
AddThis Social Bookmark Button