views:

22

answers:

2

Hello! I'm very new to ActionScript 3.0 and Flash in general. I'm trying to update a website that someone else did with Flash, and am having issues with it. I need a button to link to an outside website, but I keep getting the error "access of undefined property" on my button. I am using cs3 by the way

This is my code, any help would be much appreciated!

msds_btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler(event:MouseEvent) :void {
    navigateToURL(new URLRequest("http://www.retrohair.com/msds_html/msds_login.html"));
}

Thanks!

A: 

Hi Ryan,

Make sure the button is named correctly and added to the stage correctly. Also make sure you're not removing it from the stage. The error means that flash can't find that button instance.

Hope this helps, Will

WillDonohoe
A: 

Try naming your button

Error
1120: Access of undefined property msds_btn.

How I produced it
I reproduced the error by deleting the name 'msds_btn' from my button.

Solution
Put 'msds_btn', where it says Instance Name in Properties.

Summary
Your codes fine. I set my publishing to 'access network only' and launched the button, and it worked fine. Instance names are easy to forget. You'll see this error quite a lot :)

VideoDnd