Skip to main content
Participant
April 26, 2012
Answered

Question about online guide code for video player

  • April 26, 2012
  • 1 reply
  • 1901 views

Hello, I'm new to flash and I'm trying to make a video player following this guide http://www.photoshopcafe.com/tutorials/flash/videoplayer/videoPlayer.htm. By the end though, my code doesn't seem to like what they have there.

Here's my code:

btn1.addEventListener(MouseEvent.CLICK, vid1);

btn2.addEventListener(MouseEvent.CLICK, vid2);

btn3.addEventListener(MouseEvent.CLICK, vid3);

btn4.addEventListener(MouseEvent.CLICK, vid4);

function vid1(e:Event):void{

vidPlayer.source = "Shephard.flv"

};

function vid2(e:Event):void{

vidPlayer.source = "Austen.flv"

};

function vid3(e:Event):void{

vidPlayer.source = "LaFleur.flv"

};

function vid4(e:Event):void{

vidPlayer.source = "John.flv"

};

And here's what it yells at me:

Scene 1, Layer 'actions', Frame 1, Line 71119: Access of possibly undefined property source through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 111119: Access of possibly undefined property source through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 151119: Access of possibly undefined property source through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 191119: Access of possibly undefined property source through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 11061: Call to a possibly undefined method addEventListener through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 21061: Call to a possibly undefined method addEventListener through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 31061: Call to a possibly undefined method addEventListener through a reference with static type Class.
Scene 1, Layer 'actions', Frame 1, Line 41061: Call to a possibly undefined method addEventListener through a reference with static type Class.

I have the videos in the same folder like it says and they're flv just like the example - the only thing I changed are that there are 4 buttons and videos now. Any idea what's wrong?

Thanks a bunch for your time,

Arnold

This topic has been closed for replies.
Correct answer Ned Murphy

Based on the errors all involving static type Class objects, it would seem you might have misnamed the objects, possibly assigning those instance names in the wrong input field of the Properties panel.  The instance names should only be entered where it says <Instance Name> at the top in the Properties panel.  If you entered them somewhere else in the panel then try removing it from there.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 26, 2012

Based on the errors all involving static type Class objects, it would seem you might have misnamed the objects, possibly assigning those instance names in the wrong input field of the Properties panel.  The instance names should only be entered where it says <Instance Name> at the top in the Properties panel.  If you entered them somewhere else in the panel then try removing it from there.

Participant
April 26, 2012

I thought this might be the problem. I'm a flash newbie, but following the instructions, I don't see where to input the instance name. So I just put it as the class name. On step 2 of the guide, I dragged the flvplayback onto the stage and then converted to symbol to name it. How else would I go about naming it? I don't see the instance name box in properties.

So sorry for these basic questions and thank you so much for helping.

EDIT: I found out where to do instance names. So silly! Now, after naming the flvplayer vidPlayer, it gets rid of those errors. Now, after naming my buttons these instance names, it gives me these errors.

Scene 11046: Type was not found or was not a compile-time constant: btn1.
Scene 11046: Type was not found or was not a compile-time constant: btn2.
Scene 11046: Type was not found or was not a compile-time constant: btn3.
Scene 11046: Type was not found or was not a compile-time constant: btn4.

Any idea?

Participant
April 26, 2012

Oh my god! I got it! Thanks for your help, Ned.