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

    • CommentAuthortotalsurf
    • CommentTimeNov 20th 2008 edited
     
    Hi,

    What a fantastic generator this seems! I have just started using it and have followed the instructions on the snow flake example and have snow flakes falling beutifully on my screen.

    However, I am now trying to assign an image rather than using the RadialDot class.

    As you can see, on line 15 I have REM's out the RadialDot and put the imageclass in as suggested in the docs. In my library, I have also ensured that the image is set to export for actionscript with the class name of jb

    When I run it, I get nothing and then a hige stack of errors.

    Here is my code - can anyone help a noob?

    Thanks.

    import flash.geom.Point;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.displayObjects.RadialDot;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.twoD.actions.*;
    import org.flintparticles.twoD.emitters.Emitter2D;
    import org.flintparticles.twoD.initializers.*;
    import org.flintparticles.twoD.renderers.*;
    import org.flintparticles.twoD.zones.*;

    var emitter:Emitter2D = new Emitter2D();

    emitter.counter = new Steady( 100 );

    //emitter.addInitializer( new ImageClass( RadialDot, 2 ) );

    // below is the image class I am trying to use
    var imgClass:ImageClass = new ImageClass( jb );

    emitter.addInitializer( new Position( new LineZone( new Point( -5, -5 ), new Point( 505, -5 ) ) ) );
    emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 15 ) ) ) );
    emitter.addInitializer( new ScaleImageInit( 0.75, 2 ) );

    emitter.addAction( new Move() );
    emitter.addAction( new DeathZone( new RectangleZone( -10, -10, 520, 420 ), true ) );
    emitter.addAction( new RandomDrift( 15, 15 ) );

    var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
    addChild( renderer );
    renderer.addEmitter( emitter );

    emitter.start();
    emitter.runAhead( 10 );
    • CommentAuthorRichard
    • CommentTimeNov 20th 2008
     
    Change this line

    var imgClass:ImageClass = new ImageClass( jb );

    to this

    emitter.addInitializer( new ImageClass( jb ) );
    • CommentAuthorluka66_6
    • CommentTimeNov 24th 2008
     
    Hi

    I tryed this and it worked very nice. But i have an follow up question. Let's say that i have a bunch of different snow flake ilustrations and i wannt them all to be used by same emitter lets say at random so i do get a lot of different snow flakes. I mean I know I could just set lets say 10 different emmiters and have them all emitting one or two snowflake ilustrations at same time and place so the result would be somewhat similar but i would like to know can one emitter emmit different imageClasses from array or something. How can one do such a thing if possible?

    regards and have a nice day

    Luka
    • CommentAuthorRichard
    • CommentTimeNov 24th 2008
     
    You need the ImageClasses initializer.
    • CommentAuthortotalsurf
    • CommentTimeNov 25th 2008
     
    Hi,

    I have tried that an unfortunately it is still not working for me.

    When I look in the library, I can see that my image has a linkage of Export:jb - which I assume is correct?

    The full code I now have is below. I would be very grateful for further assistance.

    I should also mention I am using CS4 - the snow effect comiles fine, just not when I try and use an image, so I assume it not a CS4 issue.

    Thanks.

    import flash.geom.Point;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.displayObjects.RadialDot;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.twoD.actions.*;
    import org.flintparticles.twoD.emitters.Emitter2D;
    import org.flintparticles.twoD.initializers.*;
    import org.flintparticles.twoD.renderers.*;
    import org.flintparticles.twoD.zones.*;

    var emitter:Emitter2D = new Emitter2D();

    emitter.counter = new Steady( 100 );

    emitter.addInitializer( new ImageClass( jb ) );

    //emitter.addInitializer( new ImageClass( RadialDot, 2 ) );
    emitter.addInitializer( new Position( new LineZone( new Point( -5, -5 ), new Point( 505, -5 ) ) ) );
    emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 65 ) ) ) );
    emitter.addInitializer( new ScaleImageInit( 0.75, 2 ) );

    emitter.addAction( new Move() );
    emitter.addAction( new DeathZone( new RectangleZone( -10, -10, 520, 420 ), true ) );
    emitter.addAction( new RandomDrift( 15, 15 ) );

    var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
    addChild( renderer );
    renderer.addEmitter( emitter );

    emitter.start();
    emitter.runAhead( 10 );
    • CommentAuthorluka66_6
    • CommentTimeNov 28th 2008
     
    I use CS4 too and it works for me using array of images too.

    @ totalsurf: What is the error that you get? It is easer to help if we now what is an error.

    regards

    Luka

    ps: My compliments to creator of this class/library/system It rocks my world now. And my buttons look soo much cooler now. :)
    • CommentAuthortotalsurf
    • CommentTimeDec 1st 2008
     
    Hi,

    very odd! I get the following...

    ArgumentError: Error #1063: Argument count mismatch on jb(). Expected 2, got 0.
    at global/org.flintparticles.common.utils::construct()
    at org.flintparticles.common.initializers::ImageClass/initialize()
    at org.flintparticles.common.emitters::Emitter/createParticle()
    at org.flintparticles.common.emitters::Emitter/update()
    at org.flintparticles.common.emitters::Emitter/runAhead()
    at snow_fla::MainTimeline/frame1()
    ArgumentError: Error #1063: Argument count mismatch on jb(). Expected 2, got 0.
    at global/org.flintparticles.common.utils::construct()
    at org.flintparticles.common.initializers::ImageClass/initialize()
    at org.flintparticles.common.emitters::Emitter/createParticle()
    at org.flintparticles.common.emitters::Emitter/update()
    at org.flintparticles.common.emitters::Emitter/updateEventListener()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at org.flintparticles.common.utils::FrameUpdater/frameUpdate()


    The first part I get once, and the 2nd part just repeats and repeats...

    The code I have is...

    import flash.geom.Point;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.displayObjects.RadialDot;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.twoD.actions.*;
    import org.flintparticles.twoD.emitters.Emitter2D;
    import org.flintparticles.twoD.initializers.*;
    import org.flintparticles.twoD.renderers.*;
    import org.flintparticles.twoD.zones.*;

    var emitter:Emitter2D = new Emitter2D();

    emitter.counter = new Steady( 100 );

    emitter.addInitializer( new ImageClass( jb ) );

    //emitter.addInitializer( new ImageClass( RadialDot, 2 ) );
    emitter.addInitializer( new Position( new LineZone( new Point( -5, -5 ), new Point( 505, -5 ) ) ) );
    emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 65 ) ) ) );
    emitter.addInitializer( new ScaleImageInit( 0.75, 2 ) );

    emitter.addAction( new Move() );
    emitter.addAction( new DeathZone( new RectangleZone( -10, -10, 520, 420 ), true ) );
    emitter.addAction( new RandomDrift( 15, 15 ) );

    var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
    addChild( renderer );
    renderer.addEmitter( emitter );

    emitter.start();
    emitter.runAhead( 10 );

    Thanks, hope you can point out that I have done something stupid!
    • CommentAuthorRichard
    • CommentTimeDec 1st 2008
     
    Sounds like jb is a bitmap. Am I right? If so, put the bitmap into a MovieClips and export the MovieClips instead. (Bitmaps are exported as BitmapData objects not MovieClips, and hence require two parameters when initialized).
    • CommentAuthortotalsurf
    • CommentTimeDec 1st 2008
     
    you are right, I will give that a go and let you know!

    Thanks,

    Chris.
    • CommentAuthortotalsurf
    • CommentTimeDec 1st 2008
     
    Fantasic! I have it working now :-) Thanks so much, now I can continue to play with it!