FORUMS: list search recent posts

Actionscript help needed

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
honion
Actionscript help needed
on Jan 26, 2006 at 6:18:07 pm

I am a designer so there is a lot of actionscript that goes over my head but I can usually research and piece together what I need...anyway. My project involves streaming flash video. I have a large client who has significant firewall and security protection in place and therefore can not view the streaming video files because according to my server person and the company contact flash video by default uses port 1935. I need to hardcode into my actionscript for a connection to port 80. This is some script I have found along with the script I know works. I am having a little trouble figuring out what I need and what I don't. Also I don't know how to test this to see if it works, any suggestions?


// this is the code I found on macromedia's site and pasted in
// Create a new NetConnection object that will be used to
// attempt an RTMP connection.
rtmp_nc = new NetConnection();
// Create an onStatus handler that will dispose of the rtmpt_nc
// NetConnection object if this connection succeeds first.
rtmp_nc.onStatus = function(info) {
this.pending = false;
if (info.code == "NetConnection.Connect.Success") {
if (rtmpt_nc.pending) {
rtmpt_nc.onStatus = null;
rtmpt_nc.close();
rtmpt_nc = null;
clearInterval(connectionID);
}
onConnect(this);
} else
if (! rtmpt_nc.pending){
onConnectFailed(info);
}
}

// Create a new NetConnection object that will be used to
// attempt an RTMPT connection.
rtmpt_nc = new NetConnection();
// Create an onStatus handler that will dispose of the rtmp_nc
// NetConnection object if this connection succeeds.
rtmpt_nc.onStatus = function(info) {
this.pending = false;
if (info.code == "NetConnection.Connect.Success") {
if (rtmp_nc.pending) {
rtmp_nc.onStatus = null;
rtmp_nc.close();
rtmp_nc = null;
}
onConnect(this);
} else
if (! rtmp_nc.pending){
onConnectFailed(info);
}
}

// Mark both nc objects as pending.
rtmp_nc.pending = true;
rtmpt_nc.pending = true;

// Try to connect with rtmp right away:
rtmp_nc.connect("rtmp://flash.maddash.net/flashv/bsci");

// Setup an interval to try rtmpt in 250 milliseconds:
connectionID = setInterval(connectRTMPT, 250);

// Clear the interval and try to connect with RTMPT when this function is called.
function connectRTMPT(){
clearInterval(connectionID);
rtmpt_nc.connect("rtmpt://flash.maddash.net:80/flashv/bsci");
}


// This is the script I know works-Thanks Lee!
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://flash.maddash.net/flashv/bsci");

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(10);

ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
}

theVideo.attachVideo(ns);

ns.play("clin_high");

againButton.onRelease = function() {
ns.seek(0);
}

pauseButton.onRelease = function() {
ns.pause();
}

var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}

function videoStatus() {
loader.scrub._x = ns.time / duration * 235;
}

var scrubInterval;

function scrubit() {
ns.seek(Math.floor((loader.scrub._x/235) * duration));
}



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]