Flint Particle System Forum - Assign images to the snow flake demo? Sat, 25 Dec 2010 19:09:12 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=528#Comment_528 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=528#Comment_528 Thu, 20 Nov 2008 03:49:50 +0000 totalsurf
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 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=529#Comment_529 Thu, 20 Nov 2008 08:59:22 +0000 Richard
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 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=551#Comment_551 Mon, 24 Nov 2008 15:42:02 +0000 luka66_6
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 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=553#Comment_553 Mon, 24 Nov 2008 18:58:39 +0000 Richard ImageClasses initializer. ]]> Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=558#Comment_558 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=558#Comment_558 Tue, 25 Nov 2008 16:01:49 +0000 totalsurf
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 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=560#Comment_560 Fri, 28 Nov 2008 13:26:20 +0000 luka66_6
@ 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 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=562#Comment_562 Mon, 01 Dec 2008 01:23:45 +0000 totalsurf
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 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=565#Comment_565 Mon, 01 Dec 2008 08:19:04 +0000 Richard Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=567#Comment_567 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=567#Comment_567 Mon, 01 Dec 2008 12:19:36 +0000 totalsurf
Thanks,

Chris. ]]>
Assign images to the snow flake demo? http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=568#Comment_568 http://flintparticles.org/forum/comments.php?DiscussionID=134&Focus=568#Comment_568 Mon, 01 Dec 2008 14:57:57 +0000 totalsurf