Skip to main content
Known Participant
October 27, 2011
Answered

Video oncomplete event not working at all.

  • October 27, 2011
  • 1 reply
  • 731 views

When trying to use this piece of code on a flvplayback component on an air 2.7 iOs program

import fl.video.*;

import fl.video.VideoEvent;

videospeler.addEventListener(VideoEvent.COMPLETE, completePlay);

I always get the following message. It looks like internally there is a problem in flash since COMPLETE is really not undefined,

Scene 1, Layer 'AS3Layer', Frame 1, Line 74 1119: Access of possibly undefined property COMPLETE through a reference with static type Class.

Is there another way to prevent this erorr or can I somehow check another way if a flvplayback component has stopped playing ?

Kind regards,

Bart

This topic has been closed for replies.
Correct answer Joe ... Ward

This happens because there is already a flash.events.VideoEvent class, which doesn't have a COMPLETE property. Its annoying, but even when you import a class of the same name from another package, the compiler will use the built-in class rather than the imported class. The solution is to fully qualify the reference to the non-built-in class as you did in your solution. This is not a bug.

(In this case, you could also have used Event.COMPLETE, since this is just a string. Since ViedoEvent extends Event, I don't think this is too egregious, even though static members aren't inherited by subclasses.)

1 reply

Known Participant
October 27, 2011

And the solution is (while this still looks like a bug in AIR)

videospeler.addEventListener(fl.video.VideoEvent.COMPLETE, completePlay);

It's strange but this does compile while the stuff above didn't.

Joe ... WardCorrect answer
Participating Frequently
October 27, 2011

This happens because there is already a flash.events.VideoEvent class, which doesn't have a COMPLETE property. Its annoying, but even when you import a class of the same name from another package, the compiler will use the built-in class rather than the imported class. The solution is to fully qualify the reference to the non-built-in class as you did in your solution. This is not a bug.

(In this case, you could also have used Event.COMPLETE, since this is just a string. Since ViedoEvent extends Event, I don't think this is too egregious, even though static members aren't inherited by subclasses.)

Known Participant
October 27, 2011

and if I add a skin to my .FLA flvplayback component and then make sure that the skin.swf is also added to the AIR file, then on IOS this also fails. Presumably because the skin.swf will contain AS3 code ?

Is it therefore not possible to use a skin with flvplayback in an iOS AIR app ? Or is there a trick ?

Kind regards,

Bart