Buttons in ActionScript 3.0

Solved/Closed
Report
-
 Ieva -
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);

2 replies

Posts
185
Registration date
Tuesday November 18, 2008
Status
Member
Last seen
January 29, 2010
68
Hmmm really i don't know. The code looks good to me :S
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month

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
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month