Reply to: Read Flash (SWF) dimensionsApril 7, 2011 at 5:48 pm
Seems you didn't include an updated zip file. However, I have made your changes to the MCR and I can reproduce a crash. The crash is most likely because you should not be modifying the document in ***_OnInitialize. If the document needs to be modified then you should do that elsewhere, possibly in ***_OnSynchronize.
I'm assuming you basically want this:
1. If @width and @height are not set in the XML (either the attribute is missing or the value is an empty string) then read them from the SWF file and populate them automatically.
2. Draw the control at the size specified by @width and @height.
The second one is easily done in OnInitialize. It is the first one that is going to be difficult.
It is also possible that this control has some issues that make it incompatible for use this way (it was designed for use with IE and so may not have been tested when embedded in other ActiveX hosts), or perhaps this particular version has issues. If that appears to be the case it may be worth trying an older version (if one is available). The issue you have seen with multiple copies of the SWF appearing when there should only be one makes me wonder. That could be our issue as well (in either case I still cannot reproduce this).
Alternatively, you may wish to embed the IE WebBrowser control instead and interact with it. To do that you would specify Shell.Explorer as the progid in the CTM file. The trick then would be to figure out how to tunnel down to the ShockWave control that IE would load to extract these values. You may need to create an HTML page that loads the SWF file in order to do that, in which case the issue becomes even more complex to interact with the ShockWave control as you would likely need to make calls something like this from within the XMetaL script: IPC.Control.Document.parentWindow.yourcustomfunction(IPC.domnode), where yourcustomfunction() is defined inside the HTML.
If none of these things appear to work we might need to pass this on to our development team to see if they can add or extend our APIs to support this usecase (assuming this ActiveX control does not have any issues as that would be out of our control).