Please help!!! struggling with instances in as3 flash cs4

Commenta 27th October , 2009
Hello, I would be extremely greateful if someone could help me out here.

I am trying to use instances of a symbol, and creating functions relating to that instance.

This is the whole of the code, which I think is fine. I suspect I may be misunderstanding the proper way to use instances of symbols in flash or perhaps breaking some naming convention of some sort?

Up until I enter the line i have commented out here, everything runs smoothly when tested.

when i drag the symbol to the stage, and change its instance name to ‘help_main_x’ and then put in the commented out event listener and function, it gives me this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at SEQ_Classroom_AS3_261009_V3_fla::MainTimeline/frame30()

ActionScript Code:
stop(); login.addEventListener(MouseEvent.CLICK, gologin); gallery.addEventListener(MouseEvent.CLICK, gogallery); video_player.addEventListener(MouseEvent.CLICK, govideo_player); teacher_setup.addEventListener(MouseEvent.CLICK, goteacher_setup); live_student.addEventListener(MouseEvent.CLICK, golive_student); live_teacher.addEventListener(MouseEvent.CLICK, golive_teacher); contents_main.addEventListener(MouseEvent.CLICK, gocontents); help_main.addEventListener(MouseEvent.CLICK, gocontents_2); //help_mainx.addEventListener(MouseEvent.CLICK, gocontents); function gologin(e:MouseEvent):void {     gotoAndStop("login"); } function gogallery(e:MouseEvent):void {     gotoAndStop("gallery"); } function govideo_player(e:MouseEvent):void {     gotoAndStop("video_player"); } function goteacher_setup(e:MouseEvent):void {     gotoAndStop("teacher_setup"); } function golive_student(e:MouseEvent):void {     gotoAndStop("live_student"); } function golive_teacher(e:MouseEvent):void {     gotoAndStop("live_teacher"); } function gogallery_2(e:MouseEvent):void {     gotoAndStop("gallery_2"); } function gocontents(e:MouseEvent):void {     gotoAndStop("contents"); } function gocontents_2(e:MouseEvent):void {     gotoAndStop("contents_2"); }

Original post by benbneben

Lascia un Commento