Passing parameters to FMS ser-side LoadVars()
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Macromedia Flash Server > Passing parameters to FMS ser-side LoadVars()




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Passing parameters to FMS ser-side LoadVars()  
Bill Sanders


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

Hi Ed,

I'm trying to pass a property parameter to a LoadVars() object on the
ser side w/o much luck, and even if I strong-arm the return, I get
undefined. The ser-side trace shows that it's getting the property
out of the text file ok, but when I return it to the client, nada.
Any ideas?

Here's the ser-side code:

//SS
application.onAppStart = function() {
trace(this.name+" has been re-loaded");
};
application.onConnect = function(client) {
this.acceptConnection(client);
client.loadit = function(bwget) {
var loadBW = new LoadVars();
loadBW.onLoad = function(success) {
if (success) {
var bwNow=loadBW.dsl;
trace(bwget);<==I get the right name here:
trace(bwNow);<==I get the correct data from the text file here
return bwNow; <==I get undefined on the client side.
} else {
trace("loading Problem");
}
};
loadBW.load("http://localhost/bw/bw.txt");

-----
//CS
var rtmpNow:String;
rtmpNow = "rtmp://192.168.0.11/loader/bw";
//rtmpNow="rtmp:/loader/bw";
var nc:NetConnection = new NetConnection();
nc.onStatus = function(info) {
if (info.code == "NetConnection.Connect.Success") {
lighton_mc.gotoAndStop(2);
nc.call("loadit", showBW, dsl);
}
};
nc.connect(rtmpNow);
var dsl:String = "dsl";
var showBW:Object = new Object();
showBW.onResult = function(bwNow) {
bw_txt.text = bwNow;
};


Thanks,
Bill

P.S. Don't sweat getting miffed with this group. We get miffed with
each other all the time.

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






[ Post a follow-up to this message ]



    Re: Passing parameters to FMS ser-side LoadVars()  
Naicu Octavian


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

Just a small guess, but shouldn't return bwNow; be outside of the onLoad =
function?! Like this:


client.loadit =3D function(bwget) {
..
loadBW.onLoad =3D function(success) {
.. =20
}
return...
}



Bill Sanders <wdsanders-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:   Hi
 Ed,

I'm trying to pass a property parameter to a LoadVars() object on the =20
ser side w/o much luck, and even if I strong-arm the return, I get =20
undefined. The ser-side trace shows that it's getting the property =20
out of the text file ok, but when I return it to the client, nada. =20
Any ideas?

Here's the ser-side code:

//SS
application.onAppStart =3D function() {
trace(this.name+" has been re-loaded");
};
application.onConnect =3D function(client) {
this.acceptConnection(client);
client.loadit =3D function(bwget) {
var loadBW =3D new LoadVars();
loadBW.onLoad =3D function(success) {
if (success) {
var bwNow=3DloadBW.dsl;
trace(bwget);<=3D=3DI get the right name here:
trace(bwNow);<=3D=3DI get the correct data from the text file here
return bwNow; <=3D=3DI get undefined on the client side.
} else {
trace("loading Problem");
}
};
loadBW.load("http://localhost/bw/bw.txt");

-----
//CS
var rtmpNow:String;
rtmpNow =3D "rtmp://192.168.0.11/loader/bw";
//rtmpNow=3D"rtmp:/loader/bw";
var nc:NetConnection =3D new NetConnection();
nc.onStatus =3D function(info) {
if (info.code =3D=3D "NetConnection.Connect.Success") {
lighton_mc.gotoAndStop(2);
nc.call("loadit", showBW, dsl);
}
};
nc.connect(rtmpNow);
var dsl:String =3D "dsl";
var showBW:Object =3D new Object();
showBW.onResult =3D function(bwNow) {
bw_txt.text =3D bwNow;
};


Thanks,
Bill

P.S. Don't sweat getting miffed with this group. We get miffed with =20
each other all the time.

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



=09
---------------------------------
Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.

=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






[ Post a follow-up to this message ]



    RE: Passing parameters to FMS ser-side LoadVars()  
Edward Chan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

Oh, you know what, that's not quite right either.  onLoad is called
asyncrhonously.  So even if you move the return statement out of the
onLoad, the problem is that it may not have been loaded by the time you
try to return it from your loadit() function.

In fact, if you try doing the load in loadit(), you will not be able to
return the value immediately from the same method.  One possible
solution is to call a method on the client when the onLoad() is called.

Something like this:

client.loadit =3D function(bwget)
{
var loadBW =3D new LoadVars();
loadBW.client =3D this;
loadBW.onLoad =3D function(success)
{
this.client.returnValToClient(this.dsl); //
returnValToClient needs to be defined on the client-side
}
loadBW.load("http://localhost/bw/bw.txt");
}

However, if you want to initiate the load from within loadit(), there is
no way to reliably return the loaded value in the same function.
[vbcol=seagreen]
> -----Original Message-----
> From: Edward Chan=20
> Sent: Thursday, January 26, 2006 9:45 AM
> To: 'FlashComm Mailing List'
> Subject: RE: [FlashComm] Passing parameters to FMS ser-side LoadVars()
>=20
> The return statement is inside the onLoad function.  Try this
>=20 
here[vbcol=seagreen] 
> 	return loadBW.dsl; 
>=20 
> object on the=20 
> property out=20 
> application.onConnect =3D=20 
{[vbcol=seagreen] 
{[vbcol=seagreen] 
here[vbcol=seagreen] 
else
{[vbcol=seagreen] 

=-----------------------------------------------------------
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






[ Post a follow-up to this message ]



    Re: Passing parameters to FMS ser-side LoadVars()  
Bill Sanders


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

Naicu,

That's the right track,  and I believe that I'm going to have stick
some functions in there in the same scope so that I pull out the
stuff I need. Thanks, Naicu!

Bill

On Jan 26, 2006, at 12:43 PM, Naicu Octavian wrote:

> Just a small guess, but shouldn't return bwNow; be outside of the
> onLoad function?! Like this:
>
>
> client.loadit = function(bwget) {
>    ...
>    loadBW.onLoad = function(success) {
>    ...
>    }
>    return...
> }
>
>
>
> Bill Sanders <wdsanders-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:   
Hi Ed,
>
> I'm trying to pass a property parameter to a LoadVars() object on the
> ser side w/o much luck, and even if I strong-arm the return, I get
> undefined. The ser-side trace shows that it's getting the property
> out of the text file ok, but when I return it to the client, nada.
> Any ideas?
>
> Here's the ser-side code:
>
> //SS
> application.onAppStart = function() {
>   trace(this.name+" has been re-loaded");
> };
> application.onConnect = function(client) {
>   this.acceptConnection(client);
>   client.loadit = function(bwget) {
>    var loadBW = new LoadVars();
>    loadBW.onLoad = function(success) {
>     if (success) {
>      var bwNow=loadBW.dsl;
>      trace(bwget);<==I get the right name here:
>      trace(bwNow);<==I get the correct data from the text file here
>      return bwNow; <==I get undefined on the client side.
>     } else {
>      trace("loading Problem");
>     }
>    };
>    loadBW.load("http://localhost/bw/bw.txt");
>
> -----
> //CS
> var rtmpNow:String;
> rtmpNow = "rtmp://192.168.0.11/loader/bw";
> //rtmpNow="rtmp:/loader/bw";
> var nc:NetConnection = new NetConnection();
> nc.onStatus = function(info) {
>  if (info.code == "NetConnection.Connect.Success") {
>   lighton_mc.gotoAndStop(2);
>   nc.call("loadit", showBW, dsl);
>  }
> };
> nc.connect(rtmpNow);
> var dsl:String = "dsl";
> var showBW:Object = new Object();
> showBW.onResult = function(bwNow) {
>  bw_txt.text = bwNow;
> };
>
>
> Thanks,
> Bill
>
> P.S. Don't sweat getting miffed with this group. We get miffed with
> each other all the time.
>
> 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
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
>  With a free 1 GB, there's more in store with Yahoo! Mail.
>
> =-----------------------------------------------------------
> 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






[ Post a follow-up to this message ]



    Re: Passing parameters to FMS ser-side LoadVars()  
Bill Sanders


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

Ed,

Ok, thanks. After I fiddled around with what Naciu suggested, I was
still flummoxed by getting the return right. Let me go back and try
again.

Thanks a million,
Bill

On Jan 26, 2006, at 1:07 PM, Edward Chan wrote:

> Oh, you know what, that's not quite right either.  onLoad is called
> asyncrhonously.  So even if you move the return statement out of the
> onLoad, the problem is that it may not have been loaded by the time
> you
> try to return it from your loadit() function.
>
> In fact, if you try doing the load in loadit(), you will not be
> able to
> return the value immediately from the same method.  One possible
> solution is to call a method on the client when the onLoad() is
> called.
>
> Something like this:
>
> client.loadit = function(bwget)
> {
> 	var loadBW = new LoadVars();
> 	loadBW.client = this;
> 	loadBW.onLoad = function(success)
> 	{
> 		this.client.returnValToClient(this.dsl); //
> returnValToClient needs to be defined on the client-side
> 	}
> 	loadBW.load("http://localhost/bw/bw.txt");
> }
>
> However, if you want to initiate the load from within loadit(),
> there is
> no way to reliably return the loaded value in the same function.
> 
> 	 { 
> 	  { 
> 	  else
> 	  { 
>
> =-----------------------------------------------------------
> 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






[ Post a follow-up to this message ]



    Re: Passing parameters to FMS ser-side LoadVars()  
Naicu Octavian


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

Yes, Ed is totally right! I missed the asyncrhonous issue when I looked a=
t the code.

Bill Sanders <wdsanders-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: Ed,

Ok, thanks. After I fiddled around with what Naciu suggested, I was =20
still flummoxed by getting the return right. Let me go back and try =20
again.

Thanks a million,
Bill

On Jan 26, 2006, at 1:07 PM, Edward Chan wrote:

> Oh, you know what, that's not quite right either.  onLoad is called
> asyncrhonously.  So even if you move the return statement out of the
> onLoad, the problem is that it may not have been loaded by the time =20
> you
> try to return it from your loadit() function.
>
> In fact, if you try doing the load in loadit(), you will not be =20
> able to
> return the value immediately from the same method.  One possible
> solution is to call a method on the client when the onLoad() is =20
> called.
>
> Something like this:
>
> client.loadit =3D function(bwget)
> {
>  var loadBW =3D new LoadVars();
>  loadBW.client =3D this;
>  loadBW.onLoad =3D function(success)
>  {
>   this.client.returnValToClient(this.dsl); //
> returnValToClient needs to be defined on the client-side
>  }
>  loadBW.load("http://localhost/bw/bw.txt");
> }
>
> However, if you want to initiate the load from within loadit(), =20
> there is
> no way to reliably return the loaded value in the same function.
> 
re[vbcol=seagreen] 
>   { 
>    { 
re[vbcol=seagreen] 
>    else
>    { 
>
> =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



=09
---------------------------------
Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.

=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






[ Post a follow-up to this message ]



    RE: Passing parameters to FMS ser-side LoadVars()  
Edward Chan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

The return statement is inside the onLoad function.  Try this

>   client.loadit =3D function(bwget) {
>    var loadBW =3D new LoadVars();
>    loadBW.onLoad =3D function(success) {
>     if (success) {
>      var bwNow=3DloadBW.dsl;
>      trace(bwget);<=3D=3DI get the right name here:
>      trace(bwNow);<=3D=3DI get the correct data from the text file =
here
>      //return bwNow; <=3D=3DI get undefined on the client side.
>     } else {
>      trace("loading Problem");
>     }
return loadBW.dsl;
>    };

> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org=
20
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gman
e.org] On Behalf Of=20
> Bill Sanders
> Sent: Thursday, January 26, 2006 8:56 AM
> To: FlashComm Mailing List
> Subject: [FlashComm] Passing parameters to FMS ser-side LoadVars()
>=20
>   Hi Ed,
>=20
> I'm trying to pass a property parameter to a LoadVars()=20
> object on the ser side w/o much luck, and even if I=20
> strong-arm the return, I get undefined. The ser-side trace=20
> shows that it's getting the property out of the text file ok,=20
> but when I return it to the client, nada. =20
> Any ideas?
>=20
> Here's the ser-side code:
>=20
> //SS
> application.onAppStart =3D function() {
>   trace(this.name+" has been re-loaded"); };=20
> application.onConnect =3D function(client) {
>   this.acceptConnection(client);
>   client.loadit =3D function(bwget) {
>    var loadBW =3D new LoadVars();
>    loadBW.onLoad =3D function(success) {
>     if (success) {
>      var bwNow=3DloadBW.dsl;
>      trace(bwget);<=3D=3DI get the right name here:
>      trace(bwNow);<=3D=3DI get the correct data from the text file =
here
>      return bwNow; <=3D=3DI get undefined on the client side.
>     } else {
>      trace("loading Problem");
>     }
>    };
>    loadBW.load("http://localhost/bw/bw.txt");
>=20
> -----
> //CS
> var rtmpNow:String;
> rtmpNow =3D "rtmp://192.168.0.11/loader/bw";=20
> //rtmpNow=3D"rtmp:/loader/bw"; var nc:NetConnection =3D new=20
> NetConnection(); nc.onStatus =3D function(info) {
> 	if (info.code =3D=3D "NetConnection.Connect.Success") {
> 		lighton_mc.gotoAndStop(2);
> 		nc.call("loadit", showBW, dsl);
> 	}
> };
> nc.connect(rtmpNow);
> var dsl:String =3D "dsl";
> var showBW:Object =3D new Object();
> showBW.onResult =3D function(bwNow) {
> 	bw_txt.text =3D bwNow;
> };
>=20
>=20
> Thanks,
> Bill
>=20
> P.S. Don't sweat getting miffed with this group. We get=20
> miffed with each other all the time.
>=20
> bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260
>=20
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20

=-----------------------------------------------------------
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






[ Post a follow-up to this message ]



    RE: Passing parameters to FMS ser-side LoadVars()  
Edward Chan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:50 AM

You mean you were able to get the return value by simply moving the
return statement out of the onLoad? =20

> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org=
20
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gman
e.org] On Behalf Of=20
> Bill Sanders
> Sent: Thursday, January 26, 2006 10:36 AM
> To: FlashComm Mailing List
> Subject: Re: [FlashComm] Passing parameters to FMS ser-side LoadVars()
>=20
> Ed,
>=20
> Ok, thanks. After I fiddled around with what Naciu suggested,=20
> I was still flummoxed by getting the return right. Let me go=20
> back and try again.
>=20
> Thanks a million,
> Bill
>=20
> On Jan 26, 2006, at 1:07 PM, Edward Chan wrote:
>=20 
> out of the=20 
> not be able=20 
> returnValToClient needs=20 
> loadit(), there=20 
> file here 
> Behalf Of Bill=20 
> return, I get=20 
> file here 
> miffed with=20 
>=20
> bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260
>=20
>=20
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>=20

=-----------------------------------------------------------
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






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 02:36 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register