asynch call back to flash

DLL Edition of the F-IN-BOX
steanson
Posts: 5
Joined: Thu May 18, 2006 3:18 pm

asynch call back to flash

Postby steanson » Thu May 18, 2006 3:21 pm

I have a 3rd party dll that I need to use, however it takes callback functions as arguments
what would be the best approach to utilizing this.
any help much appreciated thanks Steve
:D

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu May 18, 2006 3:45 pm

Thank you for your question.

Could you tell me what exactly you want to do?
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

steanson
Posts: 5
Joined: Thu May 18, 2006 3:18 pm

Postby steanson » Thu May 18, 2006 9:09 pm

Essentially this is a voting system connected to a hardware hub that can receive votes, the dll acts as the glue to the hardware hub which receives info from a room full of voting devices.

I want to be able to call a dll method from the flash passing in a function that will be called by the dll.
I wondered whether it'd be possible to create an xml based proxy dll server that could listen for flash requests using flashes socket server mechanism or directly communicate with the dll
e.g.prototype in the dll:
ACTIVOTE_API AV_RESULT_T __stdcall AVOpen ( PACTIVOTE_REGISTRATION_CALLBACK pfnRegistrationCallback,
PACTIVOTE_VOTING_CALLBACK pfnVotingCallback
)

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri May 19, 2006 9:41 am

steanson wrote:I want to be able to call a dll method from the flash passing in a function that will be called by the dll.


In ActionScript you can use fscommand, in the C++ you can handle fscommand event and call the dll method.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

steanson
Posts: 5
Joined: Thu May 18, 2006 3:18 pm

Postby steanson » Fri May 19, 2006 10:49 am

I need the flow to be like this:

1. AS calls c++ passing an AS function to call at some later stage
2. c++ calls dll passing in a function pointer for callback
3. c++ function gets called from dll via pointer
4. c++ then calls AS function

its akin to a handler.
I think the main issue is being able to store a function to call back to AS.
Coz this is a voting application it must be asynchronous.

cheers Steve

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri May 19, 2006 11:36 am

steanson wrote:1. AS calls c++ passing an AS function to call at some later stage


AS calls fscommand(name_of_as_function), in C++ this name is saved. The 3rd party dll will call this AS function as a callback? Am I right?

steanson wrote:3. c++ function gets called from dll via pointer
4. c++ then calls AS function


The name of the AS function is saved, we can call this function using Flash External API: http://www.f-in-box.com/dll/features.ht ... ternal_api
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

steanson
Posts: 5
Joined: Thu May 18, 2006 3:18 pm

Postby steanson » Fri May 19, 2006 11:42 am

the dll needs to inform the AS via a callback of somesort
however the dll is not written with ExternalInterface API in mind.
so praps I need write a proxy to interface between the 2, just not sure how to do it using f-in-box

cheers Steve

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri May 19, 2006 12:29 pm

I still can't understand the problem...

steanson wrote:the dll needs to inform the AS via a callback of somesort


Could you describe me again about the task?

We have the flash movie and the dll. When a function of the dll is called, a pointer of callback function is passed as an argument. We need to pass something that allows to call an actionscript code as a callback? The solution: the callback calls AS using External API.

Another scenario. The movie is informed about a pointer to callback function. And later in ActionScript code we should call this callback? The solution: set a value of flash variable by the value of callback pointer / or call AS function using External API and pass the callback pointer as an argument. Later, when AS code should call the callback, it calls fscommand and pass saved callback pointer as an argument of fscommand. The C++ code handles fscommand event, extract the pointer and call the callback.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

steanson
Posts: 5
Joined: Thu May 18, 2006 3:18 pm

Postby steanson » Fri May 19, 2006 12:42 pm

I reckon the external api will do the trick
I'll investigate that thanks for all your help - much appreciated!
Could you recommend a resource/book to help me improve my c++ which is only at a basic stage! I've never written an MFC app for instance
thanks Steve

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri May 19, 2006 2:36 pm

steanson wrote:Could you recommend a resource/book to help me improve my c++ which is only at a basic stage! I've never written an MFC app for instance


I think the best resources are CodeGuru.com, CodeProject.com...
A book is good, but exploring the code is better :)
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 18 guests

cron