4 Replies - 1475 Views - Last Post: 26 May 2012 - 07:50 AM

#1 c9-adams  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 12-December 11

ActionScript

Posted 24 May 2012 - 08:11 AM

I am trying to create a flash movie which has three buttons which when clicked on opens up a different video.

This is my code so far:

function VideoOne (event: MouseEvent):void{
pubPlayer.source="symptoms-2.flv";
}
function VideoTwo (event: MouseEvent):void{
pubPlayer.source="management-2.flv";
}
function VideoThree (event: MouseEvent):void{
pubPlayer.source="causes-2.flv";
}
onev.addEventListener(MouseEvent.CLICK, VideoOne);
twov.addEventListener(MouseEvent.CLICK, VideoTwo);
threev.addEventListener(MouseEvent.CLICK, VideoThree);


My problem is is that when a button is clicked on no video is played and the output is the following:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flash_fla::MainTimeline/VideoOne()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flash_fla::MainTimeline/VideoTwo()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flash_fla::MainTimeline/VideoThree()

Can anyone help me on this please.

This post has been edited by macosxnerd101: 24 May 2012 - 02:15 PM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: ActionScript

#2 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: ActionScript

Posted 24 May 2012 - 08:37 AM

This is the standard null object reference error message that all object oriented languages contain. You need to create an instance of these objects using the 'new' keyword.

Here is a link to the actionscript.org forums that contains some posts that you might find helpful.
Was This Post Helpful? 0
  • +
  • -

#3 c9-adams  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 12-December 11

Re: ActionScript

Posted 24 May 2012 - 10:28 AM

I still don't quite understand :/
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10563
  • View blog
  • Posts: 39,087
  • Joined: 27-December 08

Re: ActionScript

Posted 24 May 2012 - 02:16 PM

With 60 posts, you should know the rules. Please use code tags when posting your code: :code:. Also, please post your programming questions in the appropriate forums. I'll move this to Flash and ActionScript.
Was This Post Helpful? 0
  • +
  • -

#5 chinchang  Icon User is offline

  • Indie Game Developer
  • member icon

Reputation: 192
  • View blog
  • Posts: 725
  • Joined: 22-December 08

Re: ActionScript

Posted 26 May 2012 - 07:50 AM

View Postc9-adams, on 24 May 2012 - 10:58 PM, said:

I still don't quite understand :/



What is pubPlayer in your code. Have you defined it anywhere?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1