Questo è quanto, ho messo le classi tutte sullo stesso livello, quindi non ci sono i percorsi, in ogni caso in questo modo a me funziona:
Codice PHP:
// Main.as
package {
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite {
public var loadingScene:LoadingScene;
public var scene:Sprite;
public function Main():void {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
loadingScene = new LoadingScene(stage);
scene = addChild(loadingScene.getScene()) as Sprite;
}
}
}
Codice PHP:
//LoadingScene.as
package {
import flash.display.Sprite;
import flash.display.Stage;
public class LoadingScene {
private var S:Sprite;
private var V:M2PVideo;
public function LoadingScene(rif:Stage) {
S = new Sprite();
V = S.addChild(new M2PVideo(rif.stageWidth, rif.stageHeight)) as M2PVideo;
V.play("http://www.helpexamples.com/flash/video/cuepoints.flv");
}
public function getScene ():Sprite {
return S;
}
}
}
Codice PHP:
//M2PVideo
package {
import flash.events.AsyncErrorEvent;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class M2PVideo extends Video {
private var NC:NetConnection;
private var NS:NetStream;
public function M2PVideo(w:int=320, h:int=240) {
super (w, h);
NC = new NetConnection();
NC.connect(null);
NS = new NetStream(NC);
attachNetStream(NS);
configureListeners();
}
public function play (flv:String):void {
NS.play(flv);
}
private function configureListeners ():void {
NC.addEventListener (NetStatusEvent.NET_STATUS, netStatusHandler);
NC.addEventListener (SecurityErrorEvent.SECURITY_ERROR, function (evt:SecurityErrorEvent):void { /* ignore security error event */ });
NS.addEventListener (NetStatusEvent.NET_STATUS, netStatusHandler);
NS.addEventListener (AsyncErrorEvent.ASYNC_ERROR, function (evt:AsyncErrorEvent):void { /* ignore async error event */ } );
NS.client = new M2PClient();
}
private function netStatusHandler (evt:NetStatusEvent):void {
if (evt.info.code == "NetStream.Play.StreamNotFound") {
dispatchEvent(evt);
}
}
}
}
Codice PHP:
//M2PClient
package {
public class M2PClient {
public function onMetaData(info:Object):void {
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
public function onCuePoint(info:Object):void {
trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
}
}
Per il mio test non ho avuto bisogno di riportare le altre classi, e con queste funziona come dovrebbe.