Home › Forums › General XMetaL Discussion › Read Flash (SWF) dimensions › Reply To: Read Flash (SWF) dimensions
Reply to: Read Flash (SWF) dimensions
April 6, 2011 at 5:48 pmThanks Derek that example was a great help
However after adapting the example I seem to have run into a severe “bug” and a graphical “glitch”.
First of all here are the following changes I made; the first includes changes to the DTD to use default width and height values:
...
href CDATA #IMPLIED
width CDATA "800"
height CDATA "600"
align (left,center,right) #IMPLIED
>
Then adding a section of code into the macro that would update the width and height attributes if they didn’t exist or were set to the defaults:
...
msg += "nnwidth:" + w + "nheight:" + h;
w = Math.round(w);
h = Math.round(h);
var widthAttribute = domnode.attributes.getNamedItem("width");
var heightAttribute = domnode.attributes.getNamedItem("height");
if(widthAttribute != null && widthAttribute.value == "" || widthAttribute.value == 800){
widthAttribute.value = w;
}
if(heightAttribute != null && heightAttribute.value == "" || heightAttribute.value == 600){
heightAttribute.value = h;
}
Application.Alert(msg);
...
Upon opening the test.xml file I am greeted with three alerts. I am guessing one for the initialising then two more for each attribute change. After the document has opened the width and height values have been successfully updated and are no longer set to 800 by 600.
The trouble comes when I create a new “swf” element beside the current “swf” element e.g.
...
..
As soon as I press enter after typing “lorem.swf” into the new and empty “href” attribute field I get two Alert messages before XMetaL 6.0 just closes without any error message. Attempting to run the exact same process via XMetaL Developer results in the same behaviour with the following output from the console:
Warning: Cannot debug script code. Incorrect function.
———————– DEBUG STARTED —————————–
Command : C:Program FilesXMetaL 6.0Authorxmetal60.exe
Command Arguments :
Working Directory : C:Program FilesXMetaL 6.0Author
———————– END OF DEBUG SESSION ———————-
The thread 0xdd8 has exited with code 0 (0x0).
The program '[3300] xmetal60.exe: Script program' has exited with code 0 (0x0).
The only way round this issue would be to edit the width and height values to something else before adding in a file name to the href attribute.
The second issue is more of a visual glitch and can be recreated at my end via the following steps:
- Open text.xml
- Crate a second “swf” element beside previous one just like before.
- To avoid XMetaL crashing change the default width and height to 801 by 601.
- Type “lorem.swf” into the “href” attribute.
- Now go ahead and delete the height or width value, giving the macro a chance to populated it with the actual width and height values from the “swf” file
- You should now see a total of thee “swf” elements on the page instead of two.
The final effect can be seen in the attached zip file which includes a screenshot (lorem_glitch.png) of this issue. Although with this issue it can be remedied by simply changing views or updating an attribute.
Any ideas why its doing these things?
Thanks
EDIT: It might be handy to know I am using Windows XP SP2, IE7 and Flash ActiveX version 10.2.152.32