views:

62

answers:

1

I'm trying to use one of Adobe's examples to put a video player in my Flash application using ActionScript 3 in Flash CS5. It's the one at the bottom of the page here:

http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html#buffering

I'm putting the ActionScript into the frame I want to play the video in. When I try to test it, I keep getting the following error message:

"1083: Syntax error: package is unexpected"

So I try taking the "package { }" code out and running it again. Then this error pops up:

"The public attribute can only be used inside a package"

I tried removing all the code inside the package and I still get the first error.

Might anyone know what's going on here? I'm sure it's something simple, but I can't figure out / find the solution. Thanks in advance.

A: 

That's a class definition. You can't put it directly onto the timeline. You need to create a file FLVPlaybackExample.as with that source code in it.

Then, as explained in the instructions above it, set the Document class of the timeline to FLVPlaybackExample. This setting is in the properties window when the Stage is selected.

(edit: sorry, not quite right instructions there)


Alternatively, if you're against classfiles, you should be able to get the same effect by placing this on the timeline (untested):

player.source = "http://www.helpexamples.com/flash/video/caption_video.flv";
player.skinBackgroundColor = 0x666666;
player.skinBackgroundAlpha = 0.5;
Chris Burt-Brown
Thanks! I was actually unaware you could include separate .as files in your Flash project. That worked.
rottendevice