Friday 13 September 2013

Execute a New Call to a Flash Object only AFTER a Flash callback completes

Execute a New Call to a Flash Object only AFTER a Flash callback completes

Note: This is very similar to the requirement of this question (Execute a
method AFTER a callback completes) - I couldn't add a comment to that one,
so I am asking a new question with a new circumstance, so hopefully
someone will have the answer.
My C# program has an embedded Flash SWF file that communicates to my C#
program using flash.external.ExternalInterface in AS3, specifically using
ExternalInterface.call(). In this case, the user is entering a PIN in
Flash and my C# program is validating that PIN. If it is invalid, I want
to tell flash to show "invalid pin" to the user. But if I try to execute a
CallFunction() on that flash object within the function that is processing
the communication from Flash, I get a COM exception. However, at any other
time outside of this function, I can execute the same CallFunction()
without a problem.
So, like the other questioner, all I need is the ability to execute the
CallFunction() only after the FlashCallback is done executing.
I know that I could put a function pointer or delegate on a timer and have
it call sometime 'later' but I'd rather have a more precise way to know
that my call to Flash will occur very soon after the Flash to C# callback
is done.
Is there a more 'built in' way in C# to put a delegate or function pointer
on some system 'stack' that then gets called like another windows event?
Ideas?

No comments:

Post a Comment