Macromedia Flash Server - Passing parameters to FMS ser-side LoadVars()

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > January 2006 > Passing parameters to FMS ser-side LoadVars()





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 Passing parameters to FMS ser-side LoadVars()
Bill Sanders

2006-01-27, 8:50 pm

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

Naicu Octavian

2006-01-27, 8:50 pm

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

Edward Chan

2006-01-27, 8:50 pm

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

Bill Sanders

2006-01-27, 8:50 pm

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

Bill Sanders

2006-01-27, 8:50 pm

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

Naicu Octavian

2006-01-27, 8:50 pm

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

Edward Chan

2006-01-27, 8:50 pm

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.gmane.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

Edward Chan

2006-01-27, 8:50 pm

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.gmane.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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com