The LegacyCaptivateLoader is a great piece or work, much thanks, it has saved countless headaches. I remember back in the roboDemo days development for these sort of "hacks" as they can be called was very limited and finding out this kind of stuff was a solo job it seemed, its great to see the Captivate development crowd has grown and I think the future is bright for Captivate being a more open environment.
That said, Ive been trying revamping our XML driven training framework to AS3. This obviously means using a system like LegacyCaptivateLoader to be able to retain communication between Captivate supplied and the framework so we can put our custom controls, show xml Closed Captions, know end-of-lesson actions, dynamic title slides, etc etc...
Im developing the system in Flex Builder, not as MXML but rather just as an actionscript project. Its code hinting/completion makes it such a powerful tool in AS projects
The Problem: When debugging (testing) the system queries dont work. It always returns 0. This means I cannot test for current slide, total slides, etc.. Commands work fine and when launching the HTML separately queries as well work. So in the end the system is working fine, just not in the testing/debug stage. This lengthens development significantly but isn't a show stopper. I'm getting to know how the system and process works so I have no clue where the problem is.
Is there anyone here with experience in using this wonderful tool inside the flex environment that may give me a hint on how I can solve this?
The main catches with LegacyCaptivateLoader are that:
A) it only works in a browser (because it needs JavaScript and ExternalInterface), and
B) the 'global ID' method has to be used to 'grab' the SWF in the HTML page (no getElementById).
If you stray from these two requirements in any way, the workaround will break. Maybe your testing/debug environment doesn't support one of these requirements?
main catches understood and both are being used. As it appears, theres something additional I need to do in Flex Builder to makes sure it debugs and test correctly.
Both Commands and Query work fine if I launch the HTML separately, but if I debug out of Flex (which opens it up in the HTML in the browser as well, just in debug mode so I can see/track traces, variables, states, etc etc etc..inside of the flex builder) only commands work, query returns 0 every time.
I have verified that the object ID for the debug HTML is still the same, in my case, MediaPlayer_test, and its using the same code, but it seems the connection from the Captivate back to AS3 swf isnt working or getting false results and reporting a 0 instead. I have no indication that anything is failing, no warnings or errors, it just reports 0 for total slides, current slide.. etc. If I then release a build (publish) and open the HTML it works fine.
Does LegacyCaptivateLoader return a 0 if the connection from AS2 Captivate to AS3 has the wrong ID or similar, or is this the value it thinks the Captivate swf is reporting. And is there any error that will be outputted if the wrong ID is supplied?
Again, this isnt a show stopper because the functions do work when the HTML is launched separately, but testing and previewing the changes and refreshing an HTML page without the ability to use debug tools will be a pain.
I was hoping someone here browsing might have had experience in working with this inside of flex builder to see if this is an issue.
Guess Ill keep plugging away to find the answer. Ill post here if I find an solution as Flex Builder is a great tool for Flash Development and I imagine others will come across the same problem
thanks for your quick answer appreciate your time.
query is designed to return a Number (not int). if the value returned from the proxy is null, the query will return 0. so if you're seeing 0s in all the queries, the communication is probably failing.
you mentioned that control works fine. when you invoke control() do you get a return value of true? if not, my guess is that the AS3-to-AS2 communication works, but the AS2-to-AS3 communication is getting hosed somewhere.
if control *does* return true, but the queries still come back as 0, you'd have me stumped.
Im stumped myself. Its just one of those developer days you want to pull all your hair out.
Soon after my last post I realized LegacyCaptivateLoader didn't work at all outside the bin-debug folder. In fact, it prevent all code from executing so nothing in the swf happened. After much frustration I realized it was a security issue and had to change the allowScriptAccess tag as well as re-publish the proxy.swf. Who knows why, still not clear on all the new security stuff or the old stuff for that matter.
But it is working in the HTML separately again, outside the debug folder, but for whatever reason the Debug version of the Flash Player doesnt allow the proxy.swf to communicate with the AS3 swf, which its connected to flexbuilder. If I refresh the HTML (which disconnects the debug session in FB) it all works. Its quite frustrating.
How do you test/debug your stuff with this having to run in the browser? Just textFields?
ya.. its difficult thats for sure, but thats only because they follow web standards... :-D
but its market share is very small so I might just end up warning the user if they are using opera that the system might not work or have the system use the local connect technique.
i like what the people at opera are doing, but they don't seem concerned about real-world implications of such strict adherence to standards. kind of "standardistas gone wild."
but if you want your site to work on the Wii, it better run in Opera!
Thats not lie. that said Opera is still alst of my worries.
Just wish I could get return communication from the as2 swf. Even the the project FlashInterface has trouble communicating back. I just dont get it, seems to work well for everyone else.
Yes they work locally, but as I wrote in the documentation, you have to set your Flash player's security to allow ExternalInterface to work on a local drive. If you don't change your settings, EI will fail silently and you'll pull your hair out.
Under "Always trust files from these locations", click "edit locations" and add the drive (or folder) that contains the files. Make sure the folder security is set to "always allow".
whoops.. you responded before I could edit my post above. I was totally missing adobe has two separate settings managers, the regular one and the one for content providers. I had been adjusting settings to the wrong one this entire time.
Thanks alot for your time, you must be working hard on programming as well to be online on a saturday :-)