Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

  1.  
    Hello,... here I am again.

    I have made a waterfall and it looks good but the particles just freeze after a while and the emitter stops emitting. It probably to heavy or something. Hopefully there is solution for keeping it runing.

    This is my code


    var renderer = new BitmapRenderer ( new Rectangle( 0, 0, 400, 250 ) );
    renderer.addFilter( new ColorMatrixFilter([ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.96,0 ]));
    addChild( renderer );


    var emitter:Emitter = new Emitter();
    emitter.counter = new Steady(10);
    emitter.addInitializer( new ImageClass( waterDrop ) );
    emitter.addInitializer( new Position( new LineZone(new Point(0,0),new Point(41,17) ) ) );
    emitter.addInitializer( new Velocity( new LineZone(new Point(0,50),new Point(0,50) ) ) );
    emitter.addInitializer( new Lifetime(1,5) );
    emitter.addAction ( new Age() );

    emitter.addAction ( new ColorChange(0xCBDBD1,0xF0F4F3) );
    emitter.addAction ( new Move());
    emitter.addAction ( new Fade(0.3,0) );
    emitter.renderer = renderer;
    emitter.start();



    You can view the project here http://www.flashingback.be/beta/
    • CommentAuthorRichard
    • CommentTimeSep 2nd 2008
     
    I've run your test site for half an hour, and the effect is still going. Also, I ran the code you posted above through the Flex profiler and there's no memory leaks or any other problems. It all seems fine.

    All I can suggest is that maybe something else on your machine is hogging memory and/or processor and slowing other software down, including the flash player.

    Flint has a fail-safe that stops it rendering frames that have a long duration (e.g. when you resize the browser window, during which flash stops, the next frame will last as long as the resize took. Flint is designed to ignore this frame).

    The emitter has a property called the maximumFrameTime that indicates the maximum length for frames to be used - if a frame is longer than this it is ignored. The default value for maximumFrameTime is 0.1 seconds. If other software is slowing flash down, it may be running slower than 10 frames per second and hence stopping. To check this, try setting maximumFrameTime to a larger value - e.g.

    emitter.maximumFrameTime = 1

    for a maximum frame time of one second.

    P.S. The effect looks great.

    P.P.S. You could optimize the effect a little by reducing the size of the BitmapRenderer to just what you need - something like

    var renderer = new BitmapRenderer ( new Rectangle( 0, 0, 50, 250 ) );
    • CommentAuthorRichard
    • CommentTimeSep 2nd 2008
     
    Another thought - if you are creating the emitter inside a function, then you're not retaining a reference to the emitter and it could be garbage collected at any time, which would freeze the renderer. Make sure you declare the emitter at some level that means the reference to it remains (as a class property in a persistent class instance or in a frame script).
  2.  
    You are probably right, my machine is pretty slow nower days and other people don't have the problem.

    [quote]P.S. The effect looks great.[/quote]

    Thx, trying to get the best out of it.

    [quote]P.P.S. You could optimize the effect a little by reducing the size of the BitmapRenderer to just what you need - something like[/quote]

    I changed that allready :)

    [quote]if you are creating the emitter inside a function, then you're not retaining a reference to the emitter and it could be garbage collected at any time, which would freeze the renderer[/quote

    Yeps you are right, it was just some quick code tot test if it was posible to make aa realistic waterfall with flint otherwise I would have used an flv


    PS: the maximumFrameTime variable doesn't exist on the emitter class or do I have an older version?
    • CommentAuthorRichard
    • CommentTimeSep 2nd 2008
     
    PS: the maximumFrameTime variable doesn't exist on the emitter class or do I have an older version?

    It was introduced in 1.0.4, so maybe you have an older version.