Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorManuel Dahm
- CommentTimeOct 4th 2008 edited
Hi there,
I am checking out Flint for the first time, which is great fun. I changed a bit the Gravity Wells example and in the beginning it runs well but after some time FPS goes down and never comes up again, even if I unload the swf, Memory though stays stable, weird actually as it was my first guess why it kept slowing down.
Below's the code, any hints for where to dig would be greatly appreciated as I am new to the Flintstone.
Cheers,
Manuel
----
emitter = new GravityWells();
renderer = new PixelRenderer( new Rectangle( 0, 0, 300, 300 ) );
renderer.addFilter( new BlurFilter(2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1.0001,0 ] ) );
renderer.addEmitter( emitter );
fx.addChild( renderer);
---
Gravity Wells.as:
private var gs : Array;
public function GravityWells()
{
gs = [];
counter = new Blast( 600 );
addInitializer( new ColorInit( 0x4ebf3aFF, 0xe63d16FF ) )
addInitializer( new Position( new DiscZone( new Point( 150, 150 ), 80) ) );
addAction( new Move() );
for (var i : Number = 0; i < 12; i++)
{
var p : Point = r();
var l:Number = Math.random()*45 + 52;
var g:GravityWell = new GravityWell( e(), p.x, p.y )
addAction( g );
gs.push({g:g, p:p, c:Math.round(Math.random()*360), l:l, i:(Math.random()*2 - 1)});
}
setInterval(onEnterFrameHandler, 100)
}
private function onEnterFrameHandler() : void
{
for (var i : Number = 0; i < gs.length; i++)
{
var o:Object = gs[i];
var g:GravityWell =o.g;
var p:Point = NonoMath.posFromAngleDistance(o.p, o.c+=o.i, o.l);
g.updatePos(p);
}
}
private function r() : Point
{
return new Point(Math.round(Math.random()*30)+122,Math.round(Math.random()*30 + 122 ));
}
private function e() : Number
{
return Math.random()*6 +6;
}
public function kill() : void
{
counter = null;
} -
- CommentAuthorRichard
- CommentTimeOct 15th 2008
Hi Manuel
I ran your example for 20 minutes with no visible slow down. I don't have the NonoMath class so had to use something else, otherwise I ran it as above.
Are you able to create a simpler example, not using NonoMath or any other classes other than Flint and Flash, that demonstrates the problem?
P.S. Your kill method will cause an error if you call it - set the counter to a ZeroCounter if you want to stop creating particles.
1 to 2 of 2
