Is the first time I post here, here's my question: (sorry for my english)
I have a desktop application programmed in Flash AS3, (not AIR) and wanted to migrate to AIR because I saw that you can have control over the files and other stuff that I need. The problem is that is ALL programmed on the TimeLine (I have never programmed with classes and really scared me a bit), so I have about 2200 lines of code in the main script all in one frame.
When I pass the proyect to AIR and I try to run it, I get a lot of errors. I searched on the internet but I find no answers. I don't konw what I'm doing wrong ... and why if I run my application with a SWF file it's works, but I got these errors when I compile for AIR.
Here, the code:
var myVideo:FLVPlayback;
function CreateFLVPlayback():void {
myVideo = new FLVPlayback(); //FLVPlayback.
//Configuration and Listeners:
myVideo.addEventListener(VideoEvent.COMPLETE, RepeatFLVPlayback); //1st ERROR
myVideo.addEventListener(VideoEvent.READY, ReadyFLVPlayback); //2nd ERROR
myVideo.addEventListener(VideoEvent.STATE_CHANGE, StateChangeFLVPlayback ); //3rd
}
// [ ... more code ...]
function StateChangeFLVPlayback(e:VideoEvent ):void {
var videoPlayer:FLVPlayback = e.target as FLVPlayback;
if (e.state == VideoState.CONNECTION_ERROR) { ///Line of the 4th ERROR
trace("No se encontró el video: "+myVideo.source );
}
}
Here the same Errors in english (using Google Translator):
For complete event try following,
myVideo.addEventListener(Event.COMPLETE, RepeatFLVPlayback);
function RepeatFLVPlayback(e:Event):void
{
//Your code
}
The READY, STATE_CHANGE are working for me in AIR 2.0 with,
import fl.video.VideoEvent;
This way it works! Don't know why!
myVideo.addEventListener("complete", RepeatFLVPlayback);
myVideo.addEventListener("ready", ReadyFLVPlayback);
I haved same problem but only with AIR for Android. I digged for this problem many hours and finally this helped me:
display.addEventListener(Event.COMPLETE, koniec);
function koniec(e:Event):void
{
display.stop();
MovieClip(root).gotoAndPlay(3);
}
So no VideoEvent but just Event instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.