Buttons in ActionScript 3.0

Solved/Closed
Ieva - Feb 18, 2009 at 11:14 AM
 Ieva - Feb 19, 2009 at 11:36 AM
Hello,
I'm trying to make my buttons clickable in flash CS4 ActionScript 3.0, but for some reason it keeps giving me the error - 1120: Access of undefined property btnHome. I have set it ups as - Instance of: btnHome and name home. What am I doing wrong? Please help!

My code looks like this

function goHome(event:MouseEvent):void
{var targetURL:URLRequest = new
URLRequest("http://www.spintopdesigns.com/");
navigateToURL(targetURL);}
btnHome.addEventListener(MouseEvent.CLICK,goHome);
Related:

2 replies

pro-genius
Posts
185
Registration date
Tuesday November 18, 2008
Status
Member
Last seen
January 29, 2010
68
Feb 19, 2009 at 11:20 AM
Hmmm really i don't know. The code looks good to me :S
1
Thanks, I figured it out, for some reason I used instance of.... and not instance name, all I had to do is change btnHome.addEventListener(MouseEvent.CLICK,goHome); to -
home.addEventListener(MouseEvent.CLICK,goHome);

Thanks for looking into that and trying to help me.
1