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

  1.  
    I am using the following intializer code which says to use one of these 3 classes (simple Shapes) and I want 1 Rect for every 10 Circles.

    addInitializer(new ImageClasses([Rect, Circle, Ring],[1,10]));

    The shapes take a color param in their constructor, at present I am randomizing the color in a base class for each shape. Is it possible to pass in parameters to their constructors? Or even better is there a way to pass in a new ImageClass for each item in the array to ImageClasses?
    • CommentAuthorRichard
    • CommentTimeFeb 20th 2011
     
    You can pass an array instead of a simple class, then the first item in the array should be the class, and the other items the parameters for the constructor. For example

    addInitializer(new ImageClasses([ [Rect, 5, 10], [Circle, 5], [Ring, 3, 5] ], [1, 10, 1] ));

    I'm not sure what you're asking with the second part of your question. Would you try explaining again.
  2.  
    I just needed to pass in params to each constructor, and couldn't see how it was done, thank you. Ignore the second part this will do nicely.
  3.  
    Hmm this is interesting... I was looking at ImageClasses and SharedImages...

    It seemed to me SharedImages was for passing instances of DisplayObject, and ImageClasses was for passing classes - so which would be more appropriate?
    In my mind his use case would warrant SharedImages usage - but again I didn't realize ImageClasses took such complex (and untyped) input.

    Just my 2 cents, I've been having so much fun playing with Flint - and I've even built my own particle systems in AS3! Just trying to get a better handle on your framework (which is much more friendly than others I've used/implemented)!
    • CommentAuthorRichard
    • CommentTimeMar 6th 2011
     
    In general, SharedImage and SharedImages are more suitable if you're using a BitmapRenderer, since this renderer can share a single display object between multiple particles. ImageClass and ImageClasses are more suitable if you're using a DisplayObjectRenderer, since this renderer requires a new display object for each particle.