Fli end

From Bennu Wiki
Jump to: navigation, search


Definition

INT Fli_end ( < INT fli_ID > )

Finishes an active fli/flc animation created by Fli_start() and frees the memory it occupies.

After using Fli_end() it's recomended to reset the handle. This will avoid crashing the program when a function tries to use the same handle again ( for example using Fli_end() a second time with the same variable ).

Reseting the handle can be done by assigning NULL to the variable that contains the Fli_ID.

Fli_ID = NULL;

See the example below

Parameters

INT Fli_ID - Identifier of the animation you want to stop.

Returns

INT : Success

1 - The animation is over.

Example

Import "mod_video";
Import "mod_key";
Import "mod_flic";

private
  int iAnimation1;
  int iAnimation2;
end

begin
  set_mode(640,480,32);

  //This simple function creates an animation at the indicated coordinates.   
  iAnimation1=fli_start("animation.fli",50,80); 

  //This creates the same animation at another coordinates. To show the power of the additional arguments
  //this animation is twice bigger, inclined 30 degrees and translucent. 
  iAnimation2=fli_start("animation.fli",350,200,0,30000,200,4);

  while(! key(_esc))

    if(key(_1))
      //Do nothing until the key is released
      while(key(_1))frame; end 
      if(iAnimation1!=null)    //If the animation wasn't terminated...
        fli_end(iAnimation1);  //...stop only the simple animation...
        iAnimation1=null;      //...and reset the handle
      else
        iAnimation1=fli_start("animation.fli",50,80); 
      end
    end

    if(key(_2))
      //Do nothing until the key is released
      while(key(_2))frame; end 
      if(iAnimation2!=null)    //If the animation wasn't terminated...
        fli_end(iAnimation2);  //...stop only the advanced animation...
        iAnimation2=null;      //...and reset the handle
      else
        iAnimation2=fli_start("animation.fli",350,200,0,30000,200,4);
      end
    end

    //If the simple animation was not terminated AND is over rewind it.
    if ( (iAnimation1!=null) and (fli_frame(iAnimation1)==0) )  
      fli_reset(iAnimation1);     				
    end

    //If the advanced animation was not terminated AND is over rewind it.
    if ( (iAnimation2!=null) and (fli_frame(iAnimation2)==0) ) 
      fli_reset(iAnimation2);  					
    end;							
    frame;
  end
end

Used in example: set_mode(), Fli_start(), Fli_frame(), Fli_reset(), key()

Notes

To stop an animation created by Start_fli() use End_fli() instead.

See also

Fli_frame(), Fli_reset(), Fli_start().


Mod_flic
Functions Endfli()Fliangle()Fliend()Fliflags()Fliframe()Fligetinfo()Flimove()Fliparams()Flireset()Flisize()Flistart()Fliz()Framefli()Resetfli()Startfli()