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

    • CommentAuthorfs_tigre
    • CommentTimeSep 8th 2008 edited
     
    Hi,

    I'm new to flint and sort of new to classes. How can I call a class from the .fla file? Lets pretend that I want to use the logo fireworks or the fire and smoke class.

    How can I call the class from my .fla file?

    Is the procedure the same for all classes or some classes require different parameters?

    Thanks,
    fs_tigre
    • CommentAuthorRichard
    • CommentTimeSep 8th 2008
     
    You'll find an example of creating the fire and smoke effect and the logofirework effect from a flash file in the examples download.
    • CommentAuthorfs_tigre
    • CommentTimeSep 9th 2008
     
    Hi Richard,

    Well I was referring more to call the class on a MOUSE_OVER or on some other event.

    Thanks,
    fs_tigre
    • CommentAuthorRichard
    • CommentTimeSep 9th 2008
     
    Using Flint is like using any other classes in Flash. If you're not experienced with classes. With version 2, all the examples have two very different versions. The flash examples use frame scripts and the flex examples use classes. If you're not experienced with classes the easiest option is to take the code that is in the first frame of the flash example, and place it in the event handler function for the mouse event you want to respond to.
    • CommentAuthorfs_tigre
    • CommentTimeSep 9th 2008
     
    Thanks
    • CommentAuthorRichard
    • CommentTimeSep 9th 2008
     
    Also, if you're using 1.0.4 you can take the code from the class constructor and place it in a frame script (or an event handler), along with all the variable declarations and import statements, and it should work fine. So the gravity wells example as a frame script is

    import flash.display.Sprite;
    import flash.filters.BlurFilter;
    import flash.filters.ColorMatrixFilter;
    import flash.geom.Point;

    import org.flintparticles.actions.*;
    import org.flintparticles.counters.*;
    import org.flintparticles.emitters.Emitter;
    import org.flintparticles.initializers.*;
    import org.flintparticles.renderers.*;
    import org.flintparticles.zones.*;

    var emitter:Emitter;
    emitter = new Emitter();
    emitter.counter = new Blast( 4000 );

    emitter.addInitializer( new ColorInit( 0xFFFF00FF, 0xFF00FFFF ) );
    emitter.addInitializer( new Position( new DiscZone( new Point( 200, 200 ), 200 ) ) );

    emitter.addAction( new Move() );
    emitter.addAction( new GravityWell( 25, 200, 200 ) );
    emitter.addAction( new GravityWell( 25, 75, 75 ) );
    emitter.addAction( new GravityWell( 25, 325, 325 ) );
    emitter.addAction( new GravityWell( 25, 75, 325 ) );
    emitter.addAction( new GravityWell( 25, 325, 75 ) );

    var renderer:PixelRenderer = new PixelRenderer();
    renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
    renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.99,0 ] ) );
    emitter.renderer = renderer;
    addChild( renderer );

    emitter.start();