Suljettu

Migrate From Action Script 2.0 to 3.0

I have been working to migrate my custom video player code from AS2 to AS3. I have been able to get everything working except the scrubber bar and the time display. If anyone is interested in helping rewrite this I would really appreciate it. The main trouble I run into is that I am using streaming video from an FMS server and that usually presents additional problems.

Here is the AS2 code that works but needs to be rewritten for AS3:

var videoInterval = setInterval(videoStatus,100);

var amountLoaded:Number;

var duration:Number;

ns["onMetaData"] = function(obj) {

duration = [url removed, login to view];

}

function checkTime(ns:NetStream,duration:TextField) {

var ns_seconds:Number = [url removed, login to view];

var minutes:Number = [url removed, login to view](ns_seconds/60);

var seconds = [url removed, login to view](ns_seconds%60);

var vidminutes:Number = [url removed, login to view](duration/60);

var vidseconds = [url removed, login to view](duration%60);

if (vidseconds<10) {

vidseconds = "0"+vidseconds;

}

if (seconds<10) {

seconds = "0"+seconds;

}

[url removed, login to view] = minutes+":"+seconds+" / "+(timeText);

}

var time_interval:Number = setInterval(checkTime,60,ns,duration);

function videoStatus() {

loader.scrub._x = [url removed, login to view] / duration * 171;

}

var scrubInterval;

[url removed, login to view] = function() {

clearInterval(videoInterval);

scrubInterval = setInterval(scrubit,10);

[url removed, login to view](false,0,this._y,171,this._y);

}

[url removed, login to view] = [url removed, login to view] = function() {

clearInterval(scrubInterval);

videoInterval = setInterval(videoStatus,100);

[url removed, login to view]();

}

function scrubit() {

[url removed, login to view]([url removed, login to view]((loader.scrub._x/171)*duration));

}

Here is the rest of the working AS3 code:

/////////////////////////////////////////////AS3 Script

////////////////////////////////////////////VIDEO CODE

var fileName:String = "video_file";

var timeText:String = "3:27";

var nc:NetConnection = new NetConnection();

var ns:NetStream;

[url removed, login to view] = [url removed, login to view];

[url removed, login to view](NetStatusEvent.NET_STATUS, onNetStatus);

var counter:int = 0;

function onNetStatus(evt:NetStatusEvent):void {

if ([url removed, login to view] =="NetConnection.Connect.Success") {

ns = new NetStream(nc);

[url removed, login to view](NetStatusEvent.NET_STATUS, onNetStatus);

[url removed, login to view](AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

var myVideo:Video = new Video(384,216);

[url removed, login to view](ns);

addChild(myVideo);

myVideo.x = 128;

myVideo.y = 30;

[url removed, login to view] = 5;

[url removed, login to view](fileName,true);

}

}

[url removed, login to view]("rtmp://server",true);

function asyncErrorHandler(event:AsyncErrorEvent):void

{

// trace([url removed, login to view]);

}

[url removed, login to view] = function(p_bw) {

//trace("onBWDone: "+p_bw);

};

[url removed, login to view] = function() {

return ++counter;

};

///////////////////////////////////////VIDEO CONTROLS CODE

[url removed, login to view](MouseEvent.MOUSE_UP, rew);

[url removed, login to view](MouseEvent.MOUSE_UP, pla);

[url removed, login to view](MouseEvent.MOUSE_UP, sto);

function rew(e:MouseEvent):void{

[url removed, login to view](0);

}

function pla(e:MouseEvent):void{

[url removed, login to view]();

}

function sto(e:MouseEvent):void{

[url removed, login to view]();

}

///////////////////////////////////////SOUND CONTROL CODE

[url removed, login to view] = true;

[url removed, login to view]([url removed, login to view], muteClick);

[url removed, login to view](MouseEvent.ROLL_OVER, muteOver);

[url removed, login to view](MouseEvent.ROLL_OUT, muteOut);

function muteClick(e:MouseEvent):void{

var c:MovieClip = mute;

if([url removed, login to view] == 10){

[url removed, login to view](30);

[url removed, login to view] = new SoundTransform(0);

}

else if([url removed, login to view] == 30){

[url removed, login to view](10);

[url removed, login to view] = new SoundTransform(1);

}

}

function muteOver(e:MouseEvent):void{

var c:MovieClip = mute;

if([url removed, login to view] == 1){

[url removed, login to view](10);

}

else if([url removed, login to view] == 20){

[url removed, login to view](30);

}

}

function muteOut(e:MouseEvent):void{

var c:MovieClip = mute;

if([url removed, login to view] == 10){

[url removed, login to view](1);

}

else if([url removed, login to view] == 30){

[url removed, login to view](20);

}

}

Taidot: Adobe Flash

Näytä lisää: flash scrub bar actionscript, actionscript seek, seek video as2, working from, working for seek, video seek bar, text to string, string problems, server resume, seek resume, seek it, seek i, script resume, script for video resume, rewrite my resume, resume seek, nc time, my seek, it seek, flash as2 to as3, event seek, event connect, counter seek, as2 to as3, as2 0

Tietoa työnantajasta:
( 0 arvostelua ) woburn, United States

Projektin tunnus: #441607

4 freelancers are bidding on average $111 for this job

shezikhan

Easy job:) Check PMB

75 $ USD 2 päivässä
(1 arvostelu)
1.1
pbochan

Hi, send me the FLA and I'll have a look at it. Thanks, Petro

250 $ USD 4 päivässä
(0 arvostelua)
0.0
nanssoftware

Lets start the work Please check pm

70 $ USD 3 päivässä
(0 arvostelua)
0.0
vasudhagupta

Hello, Please PM for details. I am interested.

50 $ USD 2 päivässä
(1 arvostelu)
0.0