Hi Guys…
I was testing out some applications written in AS3 and it worked fine untill I encountered one app when I got the Flash10i.ocx error message. I uninstalled and re-installed the flash player and this time when I run the application I got the Flash10k.ocx error. Any idea what I should do to solve the problem? I am using IE 7 and Flash CS5 and my OS is Win XP professional. I am trying to go through the code to see if there is any issue. Meantime I am posting the code here, if anyone is able to spot any issue with the coding do share with me. The code is from the book ‘Learning Flash Media Server 3’:
deux.asc (This file will be in the applications folder of the Flash Media Server 3 folder)
//Two-element array
vidStreams=["right","left"];
//Application first starts
application.onAppStart = function()
{
trace("The deux is out of the deck");
A Better Two-Way Chat Application | 101
};
//A currentClient (user) attempts to connect
application.onConnect = function(currentClient)
{
//Reject connection if array is empty
//(Two users are currently using application)
if (vidStreams.length <= 0)
{
application.rejectConnection(currentClient);
}
//Store array element in currentClient property
currentClient.cliNow=vidStreams.pop();
application.acceptConnection(currentClient);
currentClient.streamSelect = function()
{
trace("Stream "+currentClient.cliNow+" used");
//Sent the property to Client object
return currentClient.cliNow;
};
};
application.onDisconnect = function(currentClient)
{
//When currentClient leaves put the element back in array
vidStreams.push(currentClient.cliNow);
}
Deux.as
package
{
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Camera;
import flash.media.Microphone;
import flash.media.Video;
import flash.net.Responder;
public class Deux extends Sprite
{
private var nc:NetConnection;
private var good:Boolean;
private var netOut:NetStream;
private var netIn:NetStream;
private var cam:Camera;
private var mic:Microphone;
private var responder:Responder;
private var vidOut:Video;
private var vidIn:Video;
private var outStream:String;
private var inStream:String;
public function Deux ()
{
var rtmpNow="rtmp://computername/deux";
nc=new NetConnection;
nc.connect (rtmpNow);
nc.addEventListener (NetStatusEvent.NET_STATUS,getStream);
}
private function getStream (e:NetStatusEvent):void
{
good=e.info.code == "NetConnection.Connect.Success";
if (good)
{
responder=new Responder(streamNow);
nc.call ("streamSelect",responder);
}
}
private function streamNow (streamSelect:String):void
{
setCam ();
setMic ();
setVid ();
switch (streamSelect)
{
case "left" :
outStream="left";
inStream="right";
break;
case "right" :
outStream="right";
inStream="left";
break;
}
//Publish local video
netOut=new NetStream(nc);
netOut.attachAudio (mic);
netOut.attachCamera (cam);
vidOut.attachCamera (cam);
netOut.publish (outStream, "live");
//Play streamed video
netIn=new NetStream(nc);
vidIn.attachNetStream (netIn);
netIn.play (inStream);
}
private function setCam ():void
{
cam=Camera.getCamera();
cam.setMode (240,180,15);
cam.setQuality (0,85);
}
private function setMic ():void
{
mic=Microphone.getMicrophone();
mic.rate=11;
mic.setSilenceLevel (12,2000);
}
private function setVid ():void
{
vidOut=new Video(240,180);
addChild (vidOut);
vidOut.x=25;
vidOut.y=110;
vidIn=new Video(240,180);
addChild (vidIn);
vidIn.x=vidOut.x+260;
vidIn.y=110;
}
}
}
and there will be a Deux.fla file that ‘links’ to the Deux.as file.
I am using 2 computers, A and B to test this app. The FMS server also resides in computer A. The crash occurs in IE, Firefox and Chrome. Other technical info as follows:
OS: Win XP Professional
Browser: IE 7,Firefox 3.6.9, Google Chrome
Media Server: FMS 3.5
Web Server: Apachae Tomcat 7.0.4
Thanks Guys…