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


Reply to: Read Flash (SWF) dimensions

I think this example (attached as example2.zip) may get you closer to what you want.

Thanks Derek! That example proved to be very useful indeed.

In Tags On view you can click just inside an opening or closing tag to trigger a custom form called swfBrowser.xft to launch (it needs to be just inside, but not on the control itself because Shockwave eats clicks that hit it directly).

This was the only feature that our authors may not have been too keen about. The main issue was with affordance and usability where the area to click on might be too small for it to be truly helpful.

To get round this issue I removed the XFtreplacements element and added in an On_Before_Set_Attributes_From_AI macro which contained the same logic in the OnInsertElement macro. It was then customised further so the custom form would only appear if the href attribute was deleted.

It also tries to do some fancy stuff like display the full path to the SWF file in the dialog for the user but fix that up to be relative in the XML source.

I did come across a bug where if the file was not saved then the absolute path created by the swfBrowser.xft was somehow incorrect. For example the following error would appear after clicking OK when I tried to insert a new swf element when the document wasn't saved:

Windows Internet Explorer
Cannot find 'file:///C:/file:///C:/Documents%20and%20Settings/Administrator/Desktop/shapes.swf'. Make sure the path or Internet address is correct.

This was simply fixed by including an extra check before the form was opened that would ensure the document was indeed saved before it went further e.g:

 Application.Alert("Please save the document before adding Flash/ShockWave");

To keep things organised I also wanted to place the swfBrowser.xft file in the Forms folder so I decided to include an extra check that if it couldn’t find it relative to the schema then it would look in the current Application.Path Form directory.

After a few tweaks we now have a perfect solution to a problem I didn’t think was solvable in XMetaL

Thanks again