[COLOR=#333333] have the following script using an array “song”:
when publishing i get error 1120
access of undefined property song
where is my mistake?
package {
import flash.desktop.NativeApplication;
import flash.desktop.SystemIdleMode;
import flash.display.MovieClip;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
public class Main extends MovieClip {
[COLOR=#FF0000]var song:Array=[“http://www.tovale.co.il/ktantanim/lego.flv",“dag.flv”,"ez.flv”][/COLOR]
[COLOR=#FF0000] static private const VIDEO_URL:String = song[0][/COLOR]
private var netConnection:NetConnection;
private var netStream:NetStream;
private var video:Video;
public function Main() {
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
netConnection = new NetConnection();
netConnection.connect(null);
trace (VIDEO_URL)
netStream = new NetStream(netConnection);
netStream.client = this;
netStream.addEventListener(NetStatusEvent.NET_STATUS, statusUpdated);
video = new Video();
video.attachNetStream(netStream);
video.width = 480;
video.height = 320;
addChildAt(video, 0);
setupControls();
}
public function onMetaData(dataObj:Object):void {
; // Do nothing.
}
public function onXMPData(dataObj:Object):void {
; // Do nothing.
}
private function statusUpdated(e:NetStatusEvent):void {
if(e.info.code == "NetStream.Play.Stop")
{
showBtns(["playBtn"]);
}
}
private function setupControls():void {
controls.playBtn.addEventListener(MouseEvent.MOUSE_UP, playVideo);
controls.restartBtn.addEventListener(MouseEvent.MOUSE_ UP, restartVideo);
controls.resumeBtn.addEventListener(MouseEvent.MOUSE_U P, resumeVideo);
stage.addEventListener(MouseEvent.MOUSE_UP, pauseVideo);
showBtns(["playBtn"]);
}
private function playVideo(e:MouseEvent):void {
netStream.play(VIDEO_URL);
hideBtns();
e.stopPropagation();
}
private function pauseVideo(e:MouseEvent):void {
if(controls.visible == false)
{
netStream.pause();
showBtns(["resumeBtn", "restartBtn"]);
}
}
private function restartVideo(e:MouseEvent):void {
netStream.seek(0);
netStream.resume();
hideBtns();
e.stopPropagation();
}
private function resumeVideo(e:MouseEvent):void {
netStream.resume();
hideBtns();
e.stopPropagation();
}
private function hideBtns():void {
controls.visible = false;
blocker.visible = false;
}
private function showBtns(btns:Array):void {
controls.visible = true;
blocker.visible = true;
for(var instName:String in controls)
{
if(btns.indexOf(instName) != -1)
{
controls[instName].visible = true;
}
else
{
controls[instName].visible = false;
}
}
}
}
}
thanks
udi
[/COLOR]
[COLOR=#666666][FONT=adobe-clean]Reply
[/FONT]
[COLOR=#D0D0D0][FONT=adobe-clean]|[/FONT][/COLOR][FONT=adobe-clean]Edit[/FONT]
[COLOR=#D0D0D0][FONT=adobe-clean]|[/FONT][/COLOR][FONT=adobe-clean]Delete[/FONT]
[COLOR=#D0D0D0][FONT=adobe-clean]|[/FONT][/COLOR]
[/COLOR]