Ask a Question related to Macromedia Flash Flashcom, Design and Development.
-
Tokenizer #1
Calling functions from main.asc
hi all,
i'm new to flash com server ... made the following example to explain what i'm
trying to do... the bottom line is that i want to forexample be able to connect
to a remote server and after i connected write something to a textbox on the
page (which is in fla)
// here is the code in my main.asc which works
//=============================
load("components.asc");
application.onConnect =function(newClient,newUserName) {
application.acceptConnection(newClient);
newUserName = "amir";
gFrameworkFC.getClientGlobals(newClient).username =newUserName;
//application.clients[application.clients.length - 1].call("testing");
// if i uncomment the line above, the connection light stays red and
// my attempt to connect fails
trace("here");
// first off no trace is called meaning i dont see
// "here" printed to the output panel
// #2 issue is that i want to call that function
// called "testing" which is in my fla file
// and not in this main.asc
}
// ==============================
//here is the code in frame one of my flafile
#include "NetDebug.as"
myConnection_nc = new NetConnection();
myConnection_nc.onStatus = function(info) {
tracebox = "LEVEL: " + info.level + " CODE: "+info.code ;
};
testing = function (argument) {
box2.text = argument;
}
myConnection_nc.connect("rtmp://myremoteaddress.com/tokenizer", "token this");
// the connection light does turn green indicating connection
// having been made successfully
connectionlight.connect(myConnection_nc);
// ==============:brokenheart;
Tokenizer Guest
-
Calling other functions
All, Using .NET 1.1, I have built a custom control, however I am having trouble compiling it. For the on click event of the button, I want it to... -
Calling functions between frames...
JavaScript can not run on server side. You can include it in the output of your PHP script. "Albert Finchly" <Albert_Finchly@Yahoo.co.uk>... -
Calling Sub from Main form
Hello all, Is it possible to call a Subform Event Procedure in a subform, from the Main form. "Example" names: frmMyMainForm frmMySubForm -... -
Calling functions?
Hello, I wrote a jscript function within the HTML window of my webpage and would like to call it from inside the ASPX code-behind page. Any... -
calling functions
how do i call a vbscript function (which is between <%%>) from a vbscript script function (which is between script tags-<script... -
FlashTastic #2
Re: Calling functions from main.asc
>// first off no trace is called meaning i dont see
You won't see "here" on the output panel within flash. You have to load up the>// "here" printed to the output panel
FlashComm application inspector, click on the instance of your application that
is running, and select "View Detail". Your trace statements will show up under
the
"Live Log" window.
}>// #2 issue is that i want to call that function
>// called "testing" which is in my fla file
>// and not in this main.asc
netConnection.>In your FLA file, you have to define the function as a function of the}> myConnection_nc.testing = function(argument){
> box2.text = argument;
Then, on the serverside, the clientSide function can be accessed as a function
of the newClient:
================================================== =========================
load("components.asc");
application.onConnect =function(newClient,newUserName) {
application.acceptConnection(newClient);
newUserName = "amir";
gFrameworkFC.getClientGlobals(newClient).username =newUserName;
trace("here");
newClient.call("testing","This is a message from the serverside!");
}
Cheers,
FlashTastic
FlashTastic Guest
-
Tokenizer #3
Re: Calling functions from main.asc
thanks flashtastic
in regards with the locaiton of the trace() output , i see it now .... makes
sense of course
however i have no luck with with the newClient.call("testing", "asdfasdf"),
on the fla side, i did as you said
my_conn_obj.testing = function(myArg) {
_root.dynamicTextBox.text = myArg;
trace("testing is called by server side");
}
... on the asc side, i have
application.onConnect ... so on so forth:
newClient.call("testing","print this argument");
close application.onConnect
// sorry for my lazy explaination above
this is what leads to textbox having no text
and no trace being called
location of this testing definition in my code is above my_conn_obj.connect()
.... i did that to make sure that testing function is defined before the
..connect
regards
Tokenizer
Tokenizer Guest
-
FlashTastic #4
Re: Calling functions from main.asc
Sorry about that, little error in the code there.
When you call the client side function from the server-side, call it like so.
ClientObj.call("testing",null,"print this argument").
The 2nd parameter is reserved to define a result function, if you're expecting
a return value from the call, so If you're not passing a value back to the
server-side function, you have to put it as null.
FlashTastic
FlashTastic Guest
-
Tokenizer #5
Re: Calling functions from main.asc
thanks for your time.... what you told me has been mentioned in identical or
similar fashions in other tutorials i have looked at, and the fact that i can't
get it to work hence seems to be a result of configuration of my server or
something....
i have the following straight forward code which doesn't work for me... i
copied and pasted it as one final attempt to get this thing to work before i
give up on this server....
can you glance at it and see if i'm not seeing something (it must be something
small)
//================
//code from frame 1 of my FLA file
#include "NetDebug.as"
nc = new NetConnection();
nc.onStatus = function(info) {
tracebox = "LEVEL: " + info.level + " CODE: "+info.code ;
};
nc.sayHelloClient = function(arg) {
trace("here");
return (Math.random());
}
nc.connect("rtmp://myserver/myapplication", "User Name", "password");
connectionlight.connect(nc);
//=========================
// code in the main.asc
load("components.asc");
application.onConnect =function(newClient,newUserName,password) {
application.acceptConnection(newClient);
gFrameworkFC.getClientGlobals(newClient).username =newUserName;
trace(newClient.ip);
// the above does print the ip when i look at the application inspector
newClient.call("sayHelloClient", new randHandler());
}
randHandler = function(){
this.onResult = function(res){
trace(res);
}
this.onStatus = function(info){
trace("failed and got:" + info.code);
}
}
// ============
// that is it, shouldn't this work? it's not rocket science
Tokenizer Guest



Reply With Quote

