Home Forums General XMetaL Discussion Read Flash (SWF) dimensions Reply To: Read Flash (SWF) dimensions


Reply to: Read Flash (SWF) dimensions

Hi Derek,

Seems you didn't include an updated zip file.

Woops sorry about that, I made sure I included the updated version this time.

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 went ahead and placed the logic inside ***_OnSynchronize but it still resulted in a crash, the only difference being I received an Application Error:

xmetal60.exe - Application Error
The instruction at "0x00000000" referenced memory at "0x00000000". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program
OKĀ  CancelĀ 

However, after tiding up the macro code, including a mini template for the swf element and converting the width and height attribute back to #IMPLIED the crashing issue seems to have been resolved. The updated Macro, CTM and DTD file should be viewable in the attached zip file.

The issue with graphical glitches is still present; if it helps I managed to simplify the test case:

  • Open text.xml
  • Select the swf element and delete one of the width or height attributes.

For me this results in the duplication of the swf element, the updated screenshot should show this.

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).

Adobe provides archived versions of the the Flash ActiveX player here: [url=http://kb2.adobe.com/cps/142/tn_14266.html]Archived Flash Player versions[/url]
From there I was able to install version, I could go back further but so far no improvement over version 10.

It does appear that XMetaL is recreating the swf element entirely. For example the swf tags are also created and highlightable, even the Flash right mouse button context menu works.

Furthermore if I remove the ***_OnInitialize macro from the updated MCR file and follow the above steps, then when I open the test.xml file, as expected the Flash doesn't load. When I go and delete the width or height then a duplicate swf element still appears, even when the source xml says there is only one. Like before switching views removes the clone. I attached another screenshot (lorem_glitch_no_flash.png) to show this.

Depending on the desired workflow it might also be possible to call up this control without rendering it, or if that is not possible to call up IE and render it invisibly (that is possible) then query the value there, or maybe you don't mind rendering it (if a dialog is involved).

Although rendering the Flash is nice, retrieving the width and height is more important. I could certainly look into creating a custom dialog that does all this in the background and I will try looking into examples in the journalist.ctm demo before I ask any further questions on this approach.