Hi
I am making a flash presentation for uni and what I have is an intro screen, a menu with buttons and then all the different scenes of information which have a back to menu button and a next and previous button for going back and forth between the information. On each frame I have a heading and all the headings are dynamic text boxes and they all have instance names. I am using Actionscript 3 and what I have is in the Actions is that the heading moves across the screen and then stop. I am using an ENTER_FRAME so that when it enters the frame the headings move but when I go to the next frame or I click a button when it goes to the next or previous frame I get the error in the output window
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at HowdoesDRMworks9_fla::MainTimeline/moveTitle()
Here is the code I am using:
//this tell name_Txt to be placed at the x coordinate -230
name_Txt.x=-230;
//This defines an enter frame event
name_Txt.addEventListener(Event.ENTER_FRAME, moveName);
function
moveName(event:Event):void {
//This tells name_Txt that if it is less that the x coodinate 300 then move title_Txt along x by -20.
if(name_Txt.x<300){
name_Txt.x+=20;
}
}
The only thing that changes with this code on each frame is the text box instance name and the moveName.
It happens for every dynamic text that I have. I think it has something to do wit the ENTER_FRAME but I dont know.
I am in a hurry to get this finished so need to know what's going on ASAP
Please Help
James
Topic Closed [Multiple Reason] -TypeError: Error #1009: Cannot access a property or method of a null object reference.
Started by Gathanderoth, Apr 05 2008 03:35 AM
2 replies to this topic
#1
Posted 05 April 2008 - 03:35 AM
#2
Posted 05 April 2008 - 07:42 AM
I have had a look in the debug and it has something to do with this bit of code:
if(name_Txt.x<300){
name_Txt.x+=20;
}
If I comment out this code and then test is when I go to the next frame it doesnt give me this error but if i uncomment this bit off code it gives me the error when i go to the next frame
if(name_Txt.x<300){
name_Txt.x+=20;
}
If I comment out this code and then test is when I go to the next frame it doesnt give me this error but if i uncomment this bit off code it gives me the error when i go to the next frame
#3
Posted 06 April 2008 - 04:02 AM
Problem Solved
I needed to put a remove.EventListener to all the buttons so that when the buttons where clicked and it went to the next frame it removed the ENTER_FRAME event so it didnt happen on the next frame.
I needed to put a remove.EventListener to all the buttons so that when the buttons where clicked and it went to the next frame it removed the ENTER_FRAME event so it didnt happen on the next frame.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
