Flint Particle System Forum - Load images as particle (complete)2011-12-13T15:23:47+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Load images as particle (complete)http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1035#Comment_10352010-01-08T19:07:28+00:002011-12-13T15:23:47+00:00luedfehttp://flintparticles.org/forum/account.php?u=299
Hi,
I'm trying to load images as particles. Although I found this description
var emitter:Emitter2D = new Emitter2D();
var renderer:DisplayObjectRenderer = new ...
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_10362010-01-08T19:11:24+00:002011-12-13T15:23:47+00:00luedfehttp://flintparticles.org/forum/account.php?u=299
can someone give me complete code?
Load images as particle (complete)http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1037#Comment_10372010-01-09T01:34:37+00:002011-12-13T15:23:47+00:00gordeaouxhttp://flintparticles.org/forum/account.php?u=262
The simplest way is to import the png into your library, make a movie clip that contains your png, in the linkage properties for the movieclip, set the class to imgClass, and you should be good to ...
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_10392010-01-09T15:31:02+00:002010-01-09T15:31:25+00:00luedfehttp://flintparticles.org/forum/account.php?u=299
can someone show me a complete code. I have tried everything and nothing seems to work. I'm sorry.
I tried loading images via bitmapdata, linking directly in the flashfile. nothing works
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_10412010-01-11T22:43:11+00:002010-01-11T22:43:43+00:00gordeaouxhttp://flintparticles.org/forum/account.php?u=262
Change this line:
emitter.addInitializer( imgClass );
to this:
emitter.addInitializer( new ImageClass ( imgClass ) );
import your image into your flash library. Make a movieclip out ...
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_10432010-01-12T13:59:06+00:002011-12-13T15:23:47+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
When you export an image in Flash it is exported as a BitmapData. You need to get this into a bitmap to use it as a particle. To do this, you need a simple class that extends Bitmap and uses your ...
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_10472010-01-15T17:28:38+00:002011-12-13T15:23:47+00:00cambazhttp://flintparticles.org/forum/account.php?u=304
what if i want to load images from the net tru actionscript.
how can we use images as particles without making them into a movieclip???
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_10502010-01-16T20:15:55+00:002011-12-13T15:23:47+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
You need to create an image class, probably extending Bitmap, that will use the loaded image as its bitmap data.
Load images as particle (complete)http://flintparticles.org/forum/comments.php?DiscussionID=298&Focus=1136#Comment_11362010-03-04T22:58:48+00:002011-12-13T15:23:47+00:00PerlakiDesignhttp://flintparticles.org/forum/account.php?u=336
You can do it without using Flash CS3/4!
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 ...
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 ));