Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Flash       TypeError: Error #1009: Cannot access a property or method of a null object reference.

Posted on 2009-04-20
2
Medium Priority
?
590 Views
Last Modified: 2013-11-12
i am atempting to close a sub movie and go back to the host move but i get this error on click of my exit_btn plz help.

ReferenceError: Error #1069: Property activateButtons not found on flash.display.Stage and there is no default value.
      at window_fla::window_1/exit()

this is the code for the sub move exit button:
 
 
function exit(event:MouseEvent):void{
 
//define parentObj as an object holding the path to the host movie
var parentObj:Object = this.parent.parent as Object;
 
//call the function activateButtons using the path defined in parentObj
parentObj.activateButtons()	
}
 
//User Interactions
 
 
exit_btn.addEventListener(MouseEvent.CLICK, exit);
 
code from the host movie:
this is the code for the function to remove the loaded movie and reactivate the buttons
this function is called by the child loaded through the addMovie function
 
 
 
function activateButtons(){
	removeChild(movieLoader)
	// enables the buttons
	oven_btn.mouseEnabled= true
	window_btn.mouseEnabled= true
	table_btn.mouseEnabled= true
	book_btn.mouseEnabled= true
	bins_btn.mouseEnabled= true
}

Open in new window

0
Comment
Question by:chrissowerby
2 Comments
 
LVL 8

Accepted Solution

by:
Dreammonkey earned 1500 total points
ID: 24188214
You are trying to call the activateButtons method from within the MovieClip that was clicked by the user (parentObj).

That's why Flash will look for this function in the Class this MC (parentObj) is linked to. Obviously the function does not reside in the button's Class but in another one (I presume you are writing your actionscript code on the main time line ?)

You could try to call the function as is :

activateButtons();
//instead of :
parentObj.activateButtons();

If that doesn't work I might have to take a deeper look at your code...

I hope you understand all this, if you don't please shout !

DM
0
 

Author Closing Comment

by:chrissowerby
ID: 31572308
ye i took it out of the mc time line and pasted it to the main time line now its working!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question