Page 1 of 1

Could you give an example how to work with waitfor?

PostPosted: December 6th, 2005, 12:34 pm
by alexhaifa
Maybe the way I am trying to work is not correct,
I looked up in readme about waitfor

I understood so so, could you give me an example?

Assistent.StopAll;
Assistent.Play(aaDoMagic);

I should put here the code, Waitfor(aaDoMagic), something like this?

Thanks very much

PostPosted: December 7th, 2005, 10:06 am
by Kambiz
You code is wrong.

Each animation you request to play, places in a queue.

In the other hand, all Play functions return a RequestID for the animation you requested to play. Then, you should pass this value to WaitFor function, or Zero if you want to wait for the latest request.

For example:

Code: Select all
var
  ID: TRequestID;
begin
  ID := Assistant.Play(aaDoMagic);
  Assistant.WaitFor(ID);
end;

or this way:

Code: Select all
begin
  Assistant.Play(aaDoMagic);
  Assistant.WaitFor(0);
end;