Flint Particle System Forum - Assign images to the snow flake demo? 2010-06-13T02:10:34+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=528#Comment_528 2008-11-20T03:49:50+00:00 2008-11-20T08:59:44+00:00 totalsurf http://flintparticles.org/forum/account.php?u=109 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 ...
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 );
]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=529#Comment_529 2008-11-20T08:59:22+00:00 2010-06-13T02:10:34+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Change this line var imgClass:ImageClass = new ImageClass( jb ); to this emitter.addInitializer( new ImageClass( jb ) );
var imgClass:ImageClass = new ImageClass( jb );

to this

emitter.addInitializer( new ImageClass( jb ) );]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=551#Comment_551 2008-11-24T15:42:02+00:00 2010-06-13T02:10:34+01:00 luka66_6 http://flintparticles.org/forum/account.php?u=108 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 ...
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]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=553#Comment_553 2008-11-24T18:58:39+00:00 2010-06-13T02:10:34+01:00 Richard http://flintparticles.org/forum/account.php?u=1 You need the ImageClasses initializer. ImageClasses initializer.]]> Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=558#Comment_558 2008-11-25T16:01:49+00:00 2010-06-13T02:10:34+01:00 totalsurf http://flintparticles.org/forum/account.php?u=109 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 ...
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 );]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=560#Comment_560 2008-11-28T13:26:20+00:00 2010-06-13T02:10:34+01:00 luka66_6 http://flintparticles.org/forum/account.php?u=108 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 ...
@ 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. :)]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=562#Comment_562 2008-12-01T01:23:45+00:00 2010-06-13T02:10:34+01:00 totalsurf http://flintparticles.org/forum/account.php?u=109 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 ...
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!]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=565#Comment_565 2008-12-01T08:19:04+00:00 2010-06-13T02:10:34+01:00 Richard http://flintparticles.org/forum/account.php?u=1 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 ... Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=567#Comment_567 2008-12-01T12:19:36+00:00 2010-06-13T02:10:34+01:00 totalsurf http://flintparticles.org/forum/account.php?u=109 you are right, I will give that a go and let you know! Thanks, Chris.
Thanks,

Chris.]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=568#Comment_568 2008-12-01T14:57:57+00:00 2010-06-13T02:10:34+01:00 totalsurf http://flintparticles.org/forum/account.php?u=109 Fantasic! I have it working now :-) Thanks so much, now I can continue to play with it!