Macromedia Flash Server - flash class in fms2

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > October 2005 > flash class in fms2





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author flash class in fms2
heisen

2005-10-25, 2:45 am

=EF=BB=BFhi,=0Acan anyone have some clue how to use the "file class"=
in serverside=0Ait would be great to see some of the real code=0Athanks=
,=0Aheisen
________________________________________
__
Redefining your web experience! www.goowy.com

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brian Lesser

2005-10-25, 7:45 am

Hi Heisen,
Here's a short sample app that uses the File object to create a
directory listing of stream names in a shared object. It lists stream
names within the /streams/_definst_ directory. It does not try to read
subdirectories and I'm sure it can be improved on. Maybe others can
post samples that read or write to a file.
Yours truly,
-Brian

so = SharedObject.get("fileList");

var count = 0;
var intervalID;

var fileSeparator = "/";

if (application.server.indexOf("Windows") > -1){
fileSeparator = "\\";
}

function updateFileList(){
var fileName;
var streamDir = new File("/streams/_definst_");
var fileList = streamDir.list();
// Hold the file names we find this pass in the currentNames object:
var currentNames = {};
for (var i = 0; i < fileList.length; i++) {
fileName = fileList[i].toString(); // converts the file object
to a string with the full path
// fileName: C:\Program Files\Macromedia\Flash Media Server
2\applications\someApp\streams\_definst_
\someStreamFileName.flv
fileName = fileName.split(fileSeparator).pop(); // pop off the
file name from the end of the string
// fileName: someStreamFileName.flv
fileName = fileName.substring(0, fileName.indexOf(".")); //
remove the dot and extension
// fileName: someStreamFileName
currentNames[fileName] = true; // remember the file name without
extension
}

// Get the name of each stream in the so already:
var names = so.getPropertyNames();
for (i in names){
fileName = names[i];

// if the value is found delete it from the currentNames object
// as it does not need to be added.
if( so.getProperty(fileName) ){
delete currentNames[fileName];
}
else{
// if no value is found update it.
so.setProperty(fileName, null);
}
}
// Now add any left over names in currentNames to the so
for (fileName in currentNames){
so.setProperty(fileName, true);
}
}

application.onConnect = function(client){
count++;
clearInterval(intervalID);
updateFileList();
intervalID = setInterval(updateFileList, 5000);
return true;
}

application.onDisconnect = function(client){
count--;
if (count <= 0) clearInterval(intervalID);
}




heisen wrote:

>hi,
>can anyone have some clue how to use the "file class" in serverside
>it would be great to see some of the real code
>thanks,
>heisen
> ________________________________________
__
>Redefining your web experience! www.goowy.com
>
>=---------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

daz lee

2005-10-25, 7:45 am

Hey, heres a little app I built that can generate bitmaps using the file =
object.

(don=E2=80=99t advise using it in a real app, too heavy)

fczone.com/bitmap.zip
----- Original Message -----=20
From: Brian Lesser<mailto:blesser-6s6ziW1YCwCw5LPnMra/2Q@public.gmane.org>=20
To: FlashComm Mailing List<mailto:flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>=20
Sent: 25 October 2005 11:39
Subject: Re: [FlashComm] flash class in fms2


Hi Heisen,
Here's a short sample app that uses the File object to create a=20
directory listing of stream names in a shared object. It lists stream=20
names within the /streams/_definst_ directory. It does not try to read =

subdirectories and I'm sure it can be improved on. Maybe others can=20
post samples that read or write to a file.
Yours truly,
-Brian

so =3D SharedObject.get("fileList");

var count =3D 0;
var intervalID;

var fileSeparator =3D "/";

if (application.server.indexOf("Windows") > -1){
fileSeparator =3D "\\";
}

function updateFileList(){
var fileName;
var streamDir =3D new File("/streams/_definst_");
var fileList =3D streamDir.list();
// Hold the file names we find this pass in the currentNames =
object:
var currentNames =3D {};
for (var i =3D 0; i < fileList.length; i++) {
fileName =3D fileList[i].toString(); // converts the file =
object=20
to a string with the full path
// fileName: C:\Program Files\Macromedia\Flash Media Server=20
2\applications\someApp\streams\_definst_
\someStreamFileName.flv
fileName =3D fileName.split(fileSeparator).pop(); // pop off =
the=20
file name from the end of the string
// fileName: someStreamFileName.flv
fileName =3D fileName.substring(0, fileName.indexOf(".")); //=20
remove the dot and extension
// fileName: someStreamFileName
currentNames[fileName] =3D true; // remember the file name =
without=20
extension
}
=20
// Get the name of each stream in the so already:
var names =3D so.getPropertyNames();
for (i in names){
fileName =3D names[i];
=20
// if the value is found delete it from the currentNames =
object
// as it does not need to be added.
if( so.getProperty(fileName) ){
delete currentNames[fileName];
}
else{
// if no value is found update it.
so.setProperty(fileName, null);
}
}
// Now add any left over names in currentNames to the so
for (fileName in currentNames){
so.setProperty(fileName, true);
}
}

application.onConnect =3D function(client){
count++;
clearInterval(intervalID);
updateFileList();
intervalID =3D setInterval(updateFileList, 5000);
return true;
}

application.onDisconnect =3D function(client){
count--;
if (count <=3D 0) clearInterval(intervalID);
}




heisen wrote:

>hi,
>can anyone have some clue how to use the "file class" in serverside
>it would be great to see some of the real code
>thanks,
>heisen
> ________________________________________
__
>Redefining your web experience! www.goowy.com<http://www.goowy.com/>
>
>=3D---------------------------------------------------------
>Supported by Fig Leaf Software - =

http://www.figleaf.com<http://www.figleaf.com/>
>=3D---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
> =20
>



=3D-----------------------------------------------------------
Supported by Fig Leaf Software - =
http://www.figleaf.com<http://www.figleaf.com/>
=3D-----------------------------------------------------------

To change your subscription options or search the archive:
=
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm<http://chattyfig.=
figleaf.com/mailman/listinfo/flashcomm>

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Bill Sanders

2005-10-25, 7:45 am

Hi Heisen,

I did a simple one for reading and writing files for recording and
playing back FLV files--nothing sophisticated, but once I look at
Brian's, I hope it will be more so!

//Server side file object
var flvStore = new File("flv.txt");
client.WriteNow = function(flvName) {
flvStore.open("text", "append");
if (flvStore.isOpen) {
flvStore.write(flvName);
flvStore.close();
}
trace(flvName);
};
//---------------------------------------/
client.ReadNow = function() {
flvStore.open("text", "read");
trace(flvStore.isOpen+" ready");
if (flvStore.isOpen) {
contentNow = flvStore.readAll();
flvStore.close();
return contentNow;
}
};

It works like a champ except that whenever I re-record over a file,
it just adds the same name to the list box. Also, it only refreshes
the listBox on login, but that's easy to fix. Here's the CS code for
reading into the list box.

nc.call("ReadNow", FLVlist);
//--------------------------------------------------------------//
//Send contents of file to List component
var FLVlist:Object = new Object();
FLVlist.onResult = function(contentNow:Array) {
flv_list.removeAll();
for (f=0; f<contentNow.length; f++) {
flv_list.addItem(contentNow[f]);
}
};

It's part of a larger app that I'm working on that has been suspended
until I can get FMS2 on a real server (i.e., not my XP). So I really
haven't done much with it lately.

Cheers,
Bill
On Oct 25, 2005, at 6:39 AM, Brian Lesser wrote:

> Hi Heisen,
> Here's a short sample app that uses the File object to create a
> directory listing of stream names in a shared object. It lists
> stream names within the /streams/_definst_ directory. It does not
> try to read subdirectories and I'm sure it can be improved on.
> Maybe others can post samples that read or write to a file.
> Yours truly,
> -Brian
>
> so = SharedObject.get("fileList");
>
> var count = 0;
> var intervalID;
>
> var fileSeparator = "/";
>
> if (application.server.indexOf("Windows") > -1){
> fileSeparator = "\\";
> }
>
> function updateFileList(){
> var fileName;
> var streamDir = new File("/streams/_definst_");
> var fileList = streamDir.list();
> // Hold the file names we find this pass in the currentNames
> object:
> var currentNames = {};
> for (var i = 0; i < fileList.length; i++) {
> fileName = fileList[i].toString(); // converts the file
> object to a string with the full path
> // fileName: C:\Program Files\Macromedia\Flash Media Server 2
> \applications\someApp\streams\_definst_\
someStreamFileName.flv
> fileName = fileName.split(fileSeparator).pop(); // pop off
> the file name from the end of the string
> // fileName: someStreamFileName.flv
> fileName = fileName.substring(0, fileName.indexOf(".")); //
> remove the dot and extension
> // fileName: someStreamFileName
> currentNames[fileName] = true; // remember the file name
> without extension
> }
> // Get the name of each stream in the so already:
> var names = so.getPropertyNames();
> for (i in names){
> fileName = names[i];
> // if the value is found delete it from the
> currentNames object
> // as it does not need to be added.
> if( so.getProperty(fileName) ){
> delete currentNames[fileName];
> }
> else{
> // if no value is found update it.
> so.setProperty(fileName, null);
> }
> }
> // Now add any left over names in currentNames to the so
> for (fileName in currentNames){
> so.setProperty(fileName, true);
> }
> }
>
> application.onConnect = function(client){
> count++;
> clearInterval(intervalID);
> updateFileList();
> intervalID = setInterval(updateFileList, 5000);
> return true;
> }
>
> application.onDisconnect = function(client){
> count--;
> if (count <= 0) clearInterval(intervalID);
> }
>
>
>
>
> heisen wrote:
>
>
>
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>


bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Bill Sanders

2005-10-25, 5:45 pm

Daz,

That's a very impressive app Daz!

Very nice work,
Bill

On Oct 25, 2005, at 6:54 AM, daz lee wrote:

> Hey, heres a little app I built that can generate bitmaps using the =20=


> file object.
>
> (don=92t advise using it in a real app, too heavy)
>
> fczone.com/bitmap.zip
> ----- Original Message -----
> From: Brian Lesser<mailto:blesser-6s6ziW1YCwCw5LPnMra/2Q@public.gmane.org>
> To: FlashComm Mailing List<mailto:flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
> Sent: 25 October 2005 11:39
> Subject: Re: [FlashComm] flash class in fms2
>
>
> Hi Heisen,
> Here's a short sample app that uses the File object to create a
> directory listing of stream names in a shared object. It lists =20
> stream
> names within the /streams/_definst_ directory. It does not try to =20=


> read
> subdirectories and I'm sure it can be improved on. Maybe others can
> post samples that read or write to a file.
> Yours truly,
> -Brian
>
> so =3D SharedObject.get("fileList");
>
> var count =3D 0;
> var intervalID;
>
> var fileSeparator =3D "/";
>
> if (application.server.indexOf("Windows") > -1){
> fileSeparator =3D "\\";
> }
>
> function updateFileList(){
> var fileName;
> var streamDir =3D new File("/streams/_definst_");
> var fileList =3D streamDir.list();
> // Hold the file names we find this pass in the currentNames =20
> object:
> var currentNames =3D {};
> for (var i =3D 0; i < fileList.length; i++) {
> fileName =3D fileList[i].toString(); // converts the file =20=


> object
> to a string with the full path
> // fileName: C:\Program Files\Macromedia\Flash Media Server
> 2\applications\someApp\streams\_definst_
\someStreamFileName.flv
> fileName =3D fileName.split(fileSeparator).pop(); // pop =20
> off the
> file name from the end of the string
> // fileName: someStreamFileName.flv
> fileName =3D fileName.substring(0, fileName.indexOf(".")); =

//
> remove the dot and extension
> // fileName: someStreamFileName
> currentNames[fileName] =3D true; // remember the file name =20=


> without
> extension
> }
>
> // Get the name of each stream in the so already:
> var names =3D so.getPropertyNames();
> for (i in names){
> fileName =3D names[i];
>
> // if the value is found delete it from the currentNames =20
> object
> // as it does not need to be added.
> if( so.getProperty(fileName) ){
> delete currentNames[fileName];
> }
> else{
> // if no value is found update it.
> so.setProperty(fileName, null);
> }
> }
> // Now add any left over names in currentNames to the so
> for (fileName in currentNames){
> so.setProperty(fileName, true);
> }
> }
>
> application.onConnect =3D function(client){
> count++;
> clearInterval(intervalID);
> updateFileList();
> intervalID =3D setInterval(updateFileList, 5000);
> return true;
> }
>
> application.onDisconnect =3D function(client){
> count--;
> if (count <=3D 0) clearInterval(intervalID);
> }
>
>
>
>
> heisen wrote:
>
>
>
>
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com<http://=20
> www.figleaf.com/>
> =3D-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm<http://=20
> chattyfig.figleaf.com/mailman/listinfo/flashcomm>
>
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>


bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Frédéric v. Bochmann

2005-10-25, 5:45 pm

Here is a simple Logging Static class I did once.

// =
- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D

Logger =3D new Object();
Logger.fileEncoding =3D "utf8";
Logger.log =3D function (filePath, line ) {
var f =3D new File(filePath);
if(!f.exists) {
f.open(Logger.fileEncoding,"create");
f.close();
}
f.open(Logger.fileEncoding,"append");
f.writeln(line);
f.flush();
f.close();
=09
}




-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Bill =
Sanders
Sent: October 25, 2005 9:37 AM
To: FlashComm Mailing List
Subject: Re: [FlashComm] flash class in fms2

Daz,

That's a very impressive app Daz!

Very nice work,
Bill

On Oct 25, 2005, at 6:54 AM, daz lee wrote:

> Hey, heres a little app I built that can generate bitmaps using the =20
> file object.
>
> (don=92t advise using it in a real app, too heavy)
>
> fczone.com/bitmap.zip
> ----- Original Message -----
> From: Brian Lesser<mailto:blesser-6s6ziW1YCwCw5LPnMra/2Q@public.gmane.org>
> To: FlashComm Mailing List<mailto:flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
> Sent: 25 October 2005 11:39
> Subject: Re: [FlashComm] flash class in fms2
>
>
> Hi Heisen,
> Here's a short sample app that uses the File object to create a
> directory listing of stream names in a shared object. It lists =20
> stream
> names within the /streams/_definst_ directory. It does not try to =20
> read
> subdirectories and I'm sure it can be improved on. Maybe others can
> post samples that read or write to a file.
> Yours truly,
> -Brian
>
> so =3D SharedObject.get("fileList");
>
> var count =3D 0;
> var intervalID;
>
> var fileSeparator =3D "/";
>
> if (application.server.indexOf("Windows") > -1){
> fileSeparator =3D "\\";
> }
>
> function updateFileList(){
> var fileName;
> var streamDir =3D new File("/streams/_definst_");
> var fileList =3D streamDir.list();
> // Hold the file names we find this pass in the currentNames =20
> object:
> var currentNames =3D {};
> for (var i =3D 0; i < fileList.length; i++) {
> fileName =3D fileList[i].toString(); // converts the file =20
> object
> to a string with the full path
> // fileName: C:\Program Files\Macromedia\Flash Media Server
> 2\applications\someApp\streams\_definst_
\someStreamFileName.flv
> fileName =3D fileName.split(fileSeparator).pop(); // pop =20
> off the
> file name from the end of the string
> // fileName: someStreamFileName.flv
> fileName =3D fileName.substring(0, fileName.indexOf(".")); =

//
> remove the dot and extension
> // fileName: someStreamFileName
> currentNames[fileName] =3D true; // remember the file name =20
> without
> extension
> }
>
> // Get the name of each stream in the so already:
> var names =3D so.getPropertyNames();
> for (i in names){
> fileName =3D names[i];
>
> // if the value is found delete it from the currentNames =20
> object
> // as it does not need to be added.
> if( so.getProperty(fileName) ){
> delete currentNames[fileName];
> }
> else{
> // if no value is found update it.
> so.setProperty(fileName, null);
> }
> }
> // Now add any left over names in currentNames to the so
> for (fileName in currentNames){
> so.setProperty(fileName, true);
> }
> }
>
> application.onConnect =3D function(client){
> count++;
> clearInterval(intervalID);
> updateFileList();
> intervalID =3D setInterval(updateFileList, 5000);
> return true;
> }
>
> application.onDisconnect =3D function(client){
> count--;
> if (count <=3D 0) clearInterval(intervalID);
> }
>
>
>
>
> heisen wrote:
>
>
>
>
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com<http://=20
> www.figleaf.com/>
> =3D-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm<http://=20
> chattyfig.figleaf.com/mailman/listinfo/flashcomm>
>
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>


bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260


=3D---------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D---------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com