MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Spécifications Page 157

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 369
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 156
Application Development Tips and Tricks 79
Getting the stream time length in ActionScript
If you are buffering your streams, you can use the
NetStream.bufferLength property to get the
number of seconds currently in the buffer. Sometimes, however, you may want to get the total
length of a stream; in this case, the Flash Player doesnt know the length of the stream, but the
server does. The server has a
Stream.length property that the client can request through a
message to the server.
You could write client-side ActionScript such as the following to request the stream length:
function getInfo()
{
nc.call("sendInfo", new MyResultSetName(), myStream);
}
function MyResultSetName()
{
this.onResult = function(retVal)
{
_root.streamlength = retVal;
};
this.onStatus = function(info)
{
trace("Level: " + info.level + " Code: " + info.code);
// process error object
};
}
Then, in the corresponding server-side ActionScript, you would write the following in the
main.asc file:
application.onAppStart = function()
{
trace("::: Application has started :::");
}
application.onConnect = function(client)
{
application.acceptConnection(client);
// Add methods
client.prototype.sendInfo = function(name) {
var slen = Stream.length(name);
trace("slen: " + slen);
return slen;
};
}
Vue de la page 156
1 2 ... 152 153 154 155 156 157 158 159 160 161 162 ... 368 369

Commentaires sur ces manuels

Pas de commentaire