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

    • CommentAuthorluigicoria
    • CommentTimeDec 29th 2008
     
    Hello, i have my own engine, and tried to embbeb Flint engine. It works Fine when i use the basic particle, but when i try to use an Image, i get a null value in my object.

    i use a LoaderResourses Manager as Class type, but by now is impossible to run it

    i post the code so you can help me about that:



    ///////////////////////////////////////////////////
    CLASS PARTICLE
    /////////////////////////////////////////////////

    public class Particulas extends Emitter2D
    {
    private var m_ResourcesMgr : ResManager;
    private var m_ResLoaded : Res_Loader;
    private var m_Variables : Variables;
    private var m_p:MovieClip;


    public function Particulas()
    {
    OnEngineStart();
    }

    public function OnEngineStart():void
    {
    var Prototype:Class;
    m_Variables = Variables.GetInstance();

    Prototype = m_ResLoaded.LoadClassMc("Catch"); //-->/// HERE I GOT A NULL VALUE TO THE VARIABLE PROTOTYPE

    counter = new Steady(15);

    //this.addInitializer( new ImageClass( RadialDot, 4 ) ); //-->THIS WORK FINE!!
    this.addInitializer(new ImageClass(Prototype,2)); // --> THIS DOESNT WORK
    this.addInitializer( new Position(new LineZone(new Point( 0, 460), new Point(0, 70))));
    this.addInitializer( new Velocity( new PointZone( new Point( 40, 0 ) ) ) );
    this.addInitializer( new ScaleImageInit( 1, 1 ) );

    this.addAction( new Move() );
    this.addAction( new DeathZone( new RectangleZone( -10, -10, 620, 620 ), true ) );
    this.addAction( new RandomDrift( 15, 15 ) );

    this.addAction( new Move() );
    this.addAction( new DeathZone( new RectangleZone( -10, -10, 620, 420 ), true ) );
    this.addAction( new RandomDrift( 15, 15 ) );

    }

    public function OnLoad():Boolean
    {

    m_ResourcesMgr = ResManager.GetInstance();
    m_ResourcesMgr.LoadRes(m_Variables.RES_InGame);
    m_ResLoaded = m_ResourcesMgr.GetRes(m_Variables.RES_InGame);
    m_ResLoaded.addEventListener(Event.COMPLETE, LoadRes);

    return true;
    }

    private function LoadRes(ev:Event) : void
    {

    //START THE PARTICLE
    this.start();
    this.runAhead(10);

    m_ResLoaded.removeEventListener(Event.COMPLETE, LoadRes);

    }


    //////////////////////////////////////////////////////////////////////////////////
    PART OF THE CLASS RESOURCES LOADER (I GET THE CLASS NAME OF THE MOVIECLIP FROM THE SWF)
    HERE I RETURN A VALUE OF CLASS TYPE, USED IN PARTICULA CLASS LATER.
    //////////////////////////////////////////////////////////////////////////////////

    public function LoadClassMc(name:String):Class
    {
    if (!appDomain.hasDefinition(name))
    {
    trace ("error "+name);
    return null;
    }
    return appDomain.getDefinition(name) as Class;
    • CommentAuthorRichard
    • CommentTimeJan 7th 2009
     
    This looks like a problem with your class loader.
  1.  
    The problem was solved, the loader class works fine, the problem was in other side
    thanks anyway