as3_novice
06-08-2009, 01:29 AM
I have a simple class that wraps a movieClip around a Video Object and I used the class to make a simple component.
package
{
import flash.media.Video;
import flash.net.*;
import flash.display.*;
public class VideoDisplay extends MovieClip
{
private var _videoName:String;
private var nc:NetConnection
private var ns:NetStream
[Inspectable(defaultValue = "")]
public function get videoName():String {
return _videoName;
}
public function set videoName(value:String):void {
_videoName = value;
}
public function VideoDisplay():void
{
startPlay();
}
public function startPlay()
{
var myVideo:Video = new Video();
addChild(myVideo);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
myVideo.attachNetStream(ns);
ns.play(_videoName);
trace(_videoName);
}
}//class
}// package
If I hard code the video path to "ns.play()" in the class file it works fine, but when I enter the value via the Component Inspector, the value returns NULL. What am I missing. Any help would be greatly appreciated.
package
{
import flash.media.Video;
import flash.net.*;
import flash.display.*;
public class VideoDisplay extends MovieClip
{
private var _videoName:String;
private var nc:NetConnection
private var ns:NetStream
[Inspectable(defaultValue = "")]
public function get videoName():String {
return _videoName;
}
public function set videoName(value:String):void {
_videoName = value;
}
public function VideoDisplay():void
{
startPlay();
}
public function startPlay()
{
var myVideo:Video = new Video();
addChild(myVideo);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
myVideo.attachNetStream(ns);
ns.play(_videoName);
trace(_videoName);
}
}//class
}// package
If I hard code the video path to "ns.play()" in the class file it works fine, but when I enter the value via the Component Inspector, the value returns NULL. What am I missing. Any help would be greatly appreciated.