| Chmielewski yarek 2006-02-25, 5:47 pm |
| I tried your sample and simplified it a little bit:
what I have in main.ASC
application.viewStats =3D function(curr_nc, app_name)
{
trace("#CALLED HERE");
}
application.onAppStart =3D function() {
trace("# starting App");
trace("Room's starting");
application.statsInterval =3D setInterval(application.viewStats, 3000=
,=20
application.admin_nc, application.name);
....
}
I have (in the app inspector )
# starting App
Room's starting
and NOTHING else ... I NEVER receive"#CALLED HERE as I should
Have I made something wrong ?
----- Original Message -----=20
From: <lti-1a8g-LMbKfuCQv7pBDgjK7y7TUQ@public.gmane.org>
To: "FlashComm Mailing List" <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
Sent: Saturday, February 25, 2006 4:22 PM
Subject: Re: [FlashComm] SetInterval : bugs ?
> Hmm, sorry all, but to say that setInterval does not work *at all* in F=
CS=20
> 1.5 is plain bulls**t.
> We must all to take a deep breath and just be like little Fonzies : be=20
> cooooooooooool 
>
> It works, in some conditions, though, and I agree there might be nasty=20
> bugs.
>
> How the application inspector panel would work without setInterval ?
> The statistics are refreshed and computed with a setInterval.
> I know this for sure, I "examined" the SS AS code just to understand ho=
w=20
> it worked (to retrieved the current bytes_in/bytes_out).
> The app inspector panel "2.0" from "I-forgot-its-name-and-its-website-U=
RL"=20
> also uses it.
>
> Here what worked for me :
> myapp/main.asc
> ---------------------------
> application.onAppStart =3D function ()
> {
> trace("# starting App");
> this.nextClientUniqueID =3D 0;
>
> [....]
> this.admin_nc =3D new NetConnection();
> this.admin_nc.onStatus =3D function(info){
> if (info.code =3D=3D "NetConnection.Connect.Success") {
> trace("# admin connection success");
> /* LOOK HERE */
> /* NOT ACTUALLY HERE, BUT THE NEXT LINE */
> application.statsInterval =3D setInterval(application.viewSt=
ats,=20
> 3000, application.admin_nc, application.name);
> } else if (info.code =3D=3D "NetConnection.Connect.Failed") {
> trace("# admin connection failed");
> } else if (info.code =3D=3D "NetConnection.Connect.closed") {
> trace("# admin connection closed");
> clearInterval(application.statsInterval);
> // reconnect
> application.admin_nc.connect("rtmp://localhost:1111/admin",=20
> "adminlogin", "adminlogin");
> }
> };
> this.admin_nc.connect("rtmp://localhost:1111/admin", "adminlogin",=20
> "adminlogin");
> // setupLogRotationInterval( "minute" );
> }
>
> application.onAppStop =3D function()
> {
> if (application.statsInterval !=3D null)
> {
> clearInterval(application.statsInterval);
> }
> }
>
> /* the fonction being called by the setInterval */
> application.viewStats =3D function(curr_nc, app_name)
> {
> /* the function that pretends it's computing stats */
> function onGetInstStats(name)
> {
> this.name =3D name;
> this.onResult =3D function (result)
> {
> // trace("# onResult");
> var bytes_in =3D -1;
> var bytes_out =3D -1;
> var bytes_in_rate =3D 0;
> var bytes_out_rate =3D 0;
> var msgs_in_rate =3D 0;
> var msgs_out_rate =3D 0;
> var msgs_in =3D -1;
> var msgs_out =3D -1;
> var time_delta =3D 0;
> if (application.prior_time > 0)
> {
> // trace("# application.prior_time already exists");
> time_delta =3D application.getTimer() / 1000 - priorTime=
;
> } // end if
> priorTime =3D application.getTimer() / 1000;
> // for (var propp in result) {
> // trace("# propp "+propp+" =3D "+result[propp]);
> // }
>
> if (result.level =3D=3D "status")
> {
> for (var prop in result.data)
> {
> // trace("# prop =3D=3D "+prop);
> if (prop =3D=3D "bytes_in")
> {
> // trace("# prop =3D=3D bytes_in");
> bytes_in =3D result.data.bytes_in;
> if (bytes_out !=3D -1)
> {
> if (time_delta > 0)
> {
> bytes_in_rate =3D Math.floor((bytes_in -=
=20
> application.prior_bytes_in) / time_delta);
> bytes_out_rate =3D Math.floor((bytes_out=
-=20
> application.prior_bytes_out) / time_delta);
> application.app_bytes_in_rate =3D=20
> bytes_in_rate;
> application.app_bytes_out_rate =3D=20
> bytes_out_rate;
> // bytesIO_Box.text =3D "" + bytes_in_ra=
te +=20
> "/\n" + bytes_out_rate;
> // trace("# " + bytes_in_rate + "/\n" +=20
> bytes_out_rate);
> }
> else
> {
> // bytesIO_Box.text =3D "sampling...";
> // trace("# sampling...");
> } // end if
> application.prior_bytes_in =3D bytes_in;
> application.prior_bytes_out =3D bytes_out;
> application.prior_time =3D=20
> application.getTimer();
> } // end if
> }
> else if (prop =3D=3D "bytes_out")
> {
> // trace("# prop =3D=3D bytes_out");
> bytes_out =3D result.data.bytes_out;
> if (bytes_in !=3D -1)
> {
> if (time_delta > 0)
> {
> bytes_in_rate =3D Math.floor((bytes_in -=
=20
> application.prior_bytes_in) / time_delta);
> bytes_out_rate =3D Math.floor((bytes_out=
-=20
> application.prior_bytes_out) / time_delta);
> application.app_bytes_in_rate =3D=20
> bytes_in_rate;
> application.app_bytes_out_rate =3D=20
> bytes_out_rate;
> // bytesIO_Box.text =3D "" + bytes_in_ra=
te +=20
> "/\n" + bytes_out_rate;
> // trace("# " + bytes_in_rate + "/\n" +=20
> bytes_out_rate);
> }
> else
> {
> // bytesIO_Box.text =3D "sampling...";
> // trace("# sampling");
> } // end if
> application.prior_bytes_in =3D bytes_in;
> application.prior_bytes_out =3D bytes_out;
> application.prior_time =3D=20
> application.getTimer();
> } // end if
> } else {
> // trace("# prop =3D=3D "+prop);
> }
> // end if
> } // end of for...in
> } // end if
> };
> } // End of the function
> // trace("# " + application.app_bytes_in_rate + " / " +=20
> application.app_bytes_out_rate + " =3D " + (application.app_bytes_in_ra=
te +=20
> application.app_bytes_out_rate));
>
> /* The actual setIntervall'd function call */
> curr_nc.call("getInstanceStats", new onGetInstStats(app_name),=20
> app_name);
> } // End of the function
> ----------------------------------------------------
>
> See the "bytesIO_Box.text" in comments in the code ?
> It's directly taken from the app inspector (wether it is the one shippe=
d=20
> with FCS or those of the "app inspector panel 2.0").
> And this code worked for me.
> So setInterval worked for me.
> I had troubled setting it up, though (that's why I heavily relied upon=20
> code that I knew was working).
>
> Cheers, and good luck setting it up for your needs.
>
> Chmielewski yarek wrote:
>
et>[vbcol=seagreen]
=20[vbcol=seagreen]
_=20[vbcol=seagreen]
couvez=20[vbcol=seagreen]
_____=20[vbcol=seagreen]
les=20[vbcol=seagreen]
>
>
> ________________________________________
_______
> FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com=20
=09
=09
=09
________________________________________
_________________________________=
__=20
Nouveau : t=E9l=E9phonez moins cher avec Yahoo! Messenger ! D=E9couvez le=
s tarifs exceptionnels pour appeler la France et l'international.
T=E9l=E9chargez sur http://fr.messenger.yahoo.com
________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
|