Groups | Blog | Home
all groups > macromedia flash flashcom > april 2006 >

macromedia flash flashcom : delete FLV again


kruak
4/10/2006 3:55:16 PM
:confused;

Hello all,

I'm having a trouble of calling the server side to delete the selected file
from a list box. here is what I have on the server side (main.asc):

application.onConnect = function(newClient, name){

newClient.name=name;


application.acceptConnection(newClient);


var msg = "Hello! You are connected as: " + newClient.name;


newClient.call("msgFromSrvr", false, msg);

newClient.delFromSrvr = function(s){
var s = Stream.get(tempPlayFile);
trace("you selected " + s);
if(s){
s.onStatus = function(info){
if(info.code == "NetStream.Clear.Success"){
trace("Stream cleared successfully." + tempPlayFile);
}
if(info.code == "NetStream.Clear.Failed"){
trace("Failed to clear stream" + tempPlayFile);
}
};
s.clear();
}
}
}

===================
and on the FLA file after clicking the delete button:

function doDelete(){

var playFile = _global.selectedFile;
if(_global.selectedFile == undefined){
trace("select file to delete");
}else{

audio_lb.removeItemAt(audio_lb.selectedIndex);

nc.delFromSrvr = function(tempPlayFile){
var tempPlayFile:String;
var s;
_global.selectedFile = tempPlayFile;
tempPlayFile = s;
}

}

}



kruak
4/10/2006 7:47:41 PM
JayCharles
4/10/2006 8:03:20 PM
You don't need to define the method on the client side... you just need to call
it properly. Read the docs on the call method of the netconnection class


http://livedocs.macromedia.com/fms/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href
=Part_SS_ASD.html

On the server side:

newClient.delFromSrvr = function(s){
tempPlayFile = Stream.get(s);
if (tempPlayFile){
tempPlayFile.onStatus = function(info){
if(info.code == "NetStream.Clear.Success"){
trace("Stream cleared successfully.");
}
if(info.code == "NetStream.Clear.Failed"){
trace("Failed to clear stream.");
}
};
tempPlayFile.clear();
}


On the client side:

my_nc.call("delFromSrvr ", null, _global.selectedFile);



kruak
4/10/2006 9:07:17 PM
Hi Jay,

Thank you for your reply and suggestions. I read about the NetConnection
Class but still got the error message when I click on the Delete button:

Level: error Code: NetConnection.Call.Failed

=============================
I used the code you gave:

my_nc.call("delFromSrvr ", null, _global.selectedFile);

Can you help me one more time please? Thank you very much.
JayCharles
4/10/2006 9:33:51 PM
My code is an example. I typically don't post "cut-n-paste" code, but rather
the code that is in the docs. It's easier for me to copy and paste an example,
and I typically reserve my code writing time for people who are paying me : )

In your case, it looks like you didn't change the name of the netconnection
in what I pasted there. Try changing the netconnection name from my_nc to nc.
kruak
4/10/2006 9:48:44 PM
Hi Jay,

Still the same error code even when I changed from my_nc.call to nc.call. I
always get the "NetConnection.Call.Failed".

Seem like it didn't invoke the function on the server-side for the
"delFromSrvr" at all. Can you help please?

Thank you.
kruak
4/11/2006 9:48:41 PM
AddThis Social Bookmark Button