Re: SetInterval : bugs ?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Macromedia Flash Server > Re: SetInterval : bugs ?




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

    Re: SetInterval : bugs ?  
lti-1a8g-LMbKfuCQv7pBDgjK7y7TUQ@public.gmane.o


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


 
02-25-06 10:47 PM

Hmm, sorry all, but to say that setInterval does not work *at all* in=20
FCS 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 bu=
gs.

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 how=20
it worked (to retrieved the current bytes_in/bytes_out).
The app inspector panel "2.0" from=20
"I-forgot-its-name-and-its-website-URL" also uses it.

Here what worked for me :
myapp/main.asc
---------------------------
application.onAppStart =3D function ()
{
trace("# starting App");
=20
this.nextClientUniqueID =3D 0;

[....]
=20
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=20
setInterval(application.viewStats, 3000, application.admin_nc,=20
application.name);
=20
} else if (info.code =3D=3D "NetConnection.Connect.Failed") {
trace("# admin connection failed");
=20
} 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");
=20
// 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);
=20
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_rat=
e=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 application.getTim=
er();
} // 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_rat=
e=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 application.getTim=
er();
} // 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_rate=
=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 shipped=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:

> so the setInterval DOES not work in FCS 1.5 because of a BUG ?
> It does not seem serious ! ! !
>
> I have the 1.5 licenced pro.
> I am sorry but I cannot afford (for the momemnt) to purchase v2
>
>
> ----- Original Message ----- From: "Bill Sanders" <wdsanders-Wuw85uim5zBNg+MwTxZMZ
A@public.gmane.org=
t>
> To: "FlashComm Mailing List" <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@p
ublic.gmane.org>
> Sent: Saturday, February 25, 2006 1:58 PM
> Subject: Re: [FlashComm] SetInterval : bugs ?
>
>
> My understanding is that on FMS2 the bugs were fixed. Try downloading
> FMS2 and give it a try.
>
> Bill
>
> On Feb 25, 2006, at 7:51 AM, Chmielewski yarek wrote:
> 
=20[vbcol=seagreen] 
>
>
> bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260
>
>
>  ________________________________________
_______
> 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
>
>    =20
>       =20
>  ________________________________________
_______________________________=
____=20
> Nouveau : t=E9l=E9phonez moins cher avec Yahoo! Messenger ! D=E9couvez =
les=20
> 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


 ________________________________________
_______
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






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:00 AM.      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