Flint Particle System Forum - Load images as particle (complete) Tue, 13 Dec 2011 15:52:27 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1035#Comment_1035 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1035#Comment_1035 Fri, 08 Jan 2010 19:07:28 +0000 luedfe
I'm trying to load images as particles. Although I found this description

var emitter:Emitter2D = new Emitter2D();
var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
addChild( renderer );

renderer.addEmitter( emitter );
emitter.counter = new Steady( 100 );
var imgClass:ImageClass = new ImageClass( MyBall , 10, 10 ); // MyBall is exported class of ball.png


emitter.addInitializer( imgClass );
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.addAction( new Move() );
TypeError: Error #1034: Type Coercion failed: cannot convert MyBall@10906281 to flash.display.DisplayObject.
at org.flintparticles.twoD.renderers::DisplayObjectRenderer/addParticle()

I'm not abel to figgure out how to load the image itself.. how can I export a png as a class? Heven't done that yet. ]]>
Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1036#Comment_1036 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1036#Comment_1036 Fri, 08 Jan 2010 19:11:24 +0000 luedfe Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1037#Comment_1037 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1037#Comment_1037 Sat, 09 Jan 2010 01:34:37 +0000 gordeaoux
You could also look into image loading in the flash docs if you want to load the whole thing programmatically.
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#includeExamplesSummary ]]>
Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1039#Comment_1039 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1039#Comment_1039 Sat, 09 Jan 2010 15:31:02 +0000 luedfe I tried loading images via bitmapdata, linking directly in the flashfile. nothing works ]]> Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1041#Comment_1041 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1041#Comment_1041 Mon, 11 Jan 2010 22:43:11 +0000 gordeaoux
emitter.addInitializer( imgClass );


to this:

emitter.addInitializer( new ImageClass ( imgClass ) );


import your image into your flash library. Make a movieclip out of it, in the properties panel for your movie clip, check "Export for Actionscript" and type "imgClass" in the Class field. The Base Class line should auto fill to "flash.display.MovieClip".

If all of your code is in Frame 1 of your timeline, everything should work fine.

Here's an example:

http://www.fallendoor.com/test/example/imgClassExample.zip ]]>
Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1043#Comment_1043 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1043#Comment_1043 Tue, 12 Jan 2010 13:59:06 +0000 Richard
package
{
public class MyBallBitmap extends Bitmap
{
public function MyBallBitmap
{
// parameters are the width and height of the image
bitmapData = new MyBall( 10, 10 );
}
}
}


Then use this in your ImageClass initializer

var imgClass:ImageClass = new ImageClass( MyBallBitmap );
emitter.addInitializer( imgClass );
]]>
Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1047#Comment_1047 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1047#Comment_1047 Fri, 15 Jan 2010 17:28:38 +0000 cambaz
how can we use images as particles without making them into a movieclip??? ]]>
Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1050#Comment_1050 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1050#Comment_1050 Sat, 16 Jan 2010 20:15:55 +0000 Richard Load images as particle (complete) http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1136#Comment_1136 http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1136#Comment_1136 Thu, 04 Mar 2010 22:58:48 +0000 PerlakiDesign load the bitmap first,
store it in a cache class, and if you want to emit the same bitmap several times,
I mean more than 1 instance of the same bitmap at the same time on screen,
return it from the cache class like this:

private static var _bitmap : Bitmap;

static public function get bitmap() : Bitmap {
return new Bitmap(_bitmap.bitmapData.clone());
}

do a class that extends MovieClip,
something like this:

public class BitmapClass extends MovieClip {
public function BitmapClass () {
super();
addChild(BitmapCacher.bitmap);
}
}

now when you add the initializer, use the ImageClass,
and the argument will be the BitmapClass itself, and NOTan instance of it:

addInitializer( new ImageClass( BitmapSeedClass ));

Hope it's clear enough. ]]>