Skip to main content
April 13, 2009
Question

1120:Access of undefined property error

  • April 13, 2009
  • 2 replies
  • 107960 views

I'll try and be clear about my problem. I'm working on a site and have a MovieClip, named "form" on the main timeline that I want to play when a button is clicked. I keep getting this error and it's driving me crazy, I'm obiously missing something. The button instance name is "sub_btn". Below is my code , it's the subscription button code, but not quite sure what's up, I'm not an actionscript guru but am gaining a small understanding of it. If anyone can help that be awesome. Also I have a close button on that movie clip is there a simple close script I can attach. Thanks again.

Dt

stop();
import flash.events.MouseEvent;
var getHCSG:URLRequest = new URLRequest("http://www.houstonceliacs.org");
var twitter:URLRequest = new URLRequest("http://www.dggrafix.com/glutenfree/twitter.html");


// --- Page Button navigation --- \\

home_btn.addEventListener(MouseEvent.CLICK, hClick);
glutenfree_btn.addEventListener(MouseEvent.CLICK, gClick);
menu_btn.addEventListener(MouseEvent.CLICK, mClick);
restaurant_btn.addEventListener(MouseEvent.CLICK, rClick);
contact_btn.addEventListener(MouseEvent.CLICK, cClick);

function hClick(event:MouseEvent):void{
    gotoAndPlay("home");
}
function gClick(event:MouseEvent):void{
    gotoAndPlay("glutenfree");
}
function mClick(event:MouseEvent):void{
    gotoAndPlay("menu");
}
function rClick(event:MouseEvent):void{
    gotoAndPlay("restaurants");
}
function cClick(event:MouseEvent):void{
    gotoAndPlay("contact");
}

// -- Get URL Button -- \\

supportgrp_btn.addEventListener(MouseEvent.CLICK, hcClick);

function hcClick(event:MouseEvent):void{
    navigateToURL(getHCSG);
}
twitter_btn.addEventListener(MouseEvent.CLICK, tClick);

function tClick(event:MouseEvent):void{
    navigateToURL(twitter);
}

// --- Subcribtion Button navigation --- \\

sub_btn.addEventListener(MouseEvent.CLICK, clClick);

function clClick(event:MouseEvent):void{
    form.play();
}

This topic has been closed for replies.

2 replies

Participant
May 12, 2010

Hi,

I also have almost similar problem to this.  Mine is going to a frame "reservationpage".  I set a button on  frame 3 in "treatmentspage" that should call on "reservationpage" in frame 8.

I have been using this code:

myreserve_btn.addEventListener(MouseEvent.CLICK, onReservClick);

function onReservClick(evt:MouseEvent):void {
    gotoAndStop("reservation page");
   
    myreserve_btn.removeEventListener(MouseEvent.CLICK, onReservClick);
}

but keep getting:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at SpaLuvicebestmassageoptionintown_fla::MainTimeline/frame3()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at SpaLuvicebestmassageoptionintown_fla::innnerbody_25()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at flash.display::MovieClip/gotoAndStop()
    at SpaLuvicebestmassageoptionintown_fla::MainTimeline/bodymassagebtn_clicked()

can I get help on this please?

Ned Murphy
Legend
April 13, 2009

Can you provide the complete error message?

April 13, 2009

Thanks for responding, the full error message is:

Symbol 'Main', Layer 'actions', Frame 1, Line 46  1120:Acess of undefined property sub_btn.

I think I checked that the instance name is correct but just can't get it.

Dt