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'm writing biomedical simulations using Flint (see an example at http://elearning.millipore.com) and I'm using the dictionary property to add additional data to each particle. I've found it useful to have a generic initializer that will take a "template" object and stuff the values into the dictionary.

    May I propose this become part of a future release?

    ...Richard

    --- cut here ---

    package org.flintparticles.common.initializers
    {
    import flash.utils.Dictionary;

    import org.flintparticles.common.emitters.Emitter;
    import org.flintparticles.common.particles.Particle;

    public class DictionaryInitializer extends InitializerBase
    {
    private var _template: Object;

    public function DictionaryInitializer(template:Object)
    {
    _template = template;
    }

    public override function initialize(emitter:Emitter, particle:Particle):void
    {
    if (_template == null) return;
    var dict: Dictionary = particle.dictionary;
    for (var key:* in _template) {
    dict[key] = _template[key];
    }
    }

    }
    }
    • CommentAuthorRichard
    • CommentTimeJun 17th 2010
     
    Hi Richard

    Sounds like a good idea. I'll try to include it soon.

    Richard