Using StratifiedJS with AS3 ExternalInterface.call

18 views
Skip to first unread message

afc.c...@gmail.com

unread,
Aug 2, 2017, 11:58:49 AM8/2/17
to StratifiedJS
Hi!

I have a flash application which has a need of accessing indexedDB implementation provided by Chrome / Firefox. AS3 is synchronous but IndexedDB APIs are currently all asynchronous and callback based. I can't change the flash application code to account for callbacks and was hoping StratifiedJS could help me on this.

Basically i have tried calling a StratifiedJS function from AS3 ExternalInterface.call method, StratifiedJS does its bit on resuming only when the callback has come and i try to return the obtained value as a return argument. But the AS3 ExternalInterface.call method always seem to get NULL as the return value (I guess it is not waiting for the actual return to happen).

Has anyone faced this issue and is there is workaround for this? 

Thanks!

Alexander Fritze

unread,
Aug 2, 2017, 12:41:19 PM8/2/17
to strati...@googlegroups.com
Unfortunately you can't solve this with SJS.

While SJS code can be called from non-SJS code, the calling code will
still need to be callback based. So for your particular case, where
you basically want to get a synchronous version of an asynchronous
API, introducing SJS down the line doesn't help at all. What you'd
really want is the flash application code to be SJS-based (which I
understand is not possible).

My best advice would be to try to use
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
instead of IndexedDB.
> --
> You received this message because you are subscribed to the Google Groups
> "StratifiedJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to stratifiedjs...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

afc.c...@gmail.com

unread,
Aug 4, 2017, 1:54:21 AM8/4/17
to StratifiedJS

Thanks a lot for a quick reply and suggestions Alexander!

LocalStorage's size limit is very restricting compared to IndexedDB.. I was looking to store about 100-200MB of data and hence the choice of IndexedDB.
Will probably look at other options... 

Thanks Again!
Reply all
Reply to author
Forward
0 new messages