swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] Converting AVM1 swfs to AVM2


From: Manuel Fittko
Subject: [Swftools-common] Converting AVM1 swfs to AVM2
Date: Thu, 10 Dec 2009 16:03:16 +0100

Hi,

on our platform we have a flash-based document viewer with documents created 
with the proprietary Print2Flash swf printer. Since this printer does not 
provide the option of printing single page sprites I had to extract the 
containing sprites using a combination of swfdump and swfextract, which was 
already quite successful. I could also successfully convert the AVM1 swfs to 
AVM2 using swfcombine, combining the AVM1 swf with an empty AVM2 swf.

The remaining problem is, that I cannot access the extracted SWF's textSnapshot 
property. In other words the textSnapshot.charCount property is zero.

It would be very nice if someone could contribute to a solution to my problem 
or at least give me some hints in how to optimize the following bash script 
and/or help me with the translation for windows cmd (batch file).

Thank you in advance,
Manuel Fittko

Flex developer at http://txtr.com

The bash-script...

#!/bin/bash
echo "Converting $1 to single page AVM2 sprites.
Please wait..."
TMPFILE=dump.tmp
mkdir $2
`swfdump $1| awk /Page[0-9]/ | sed 's/ *exports//' | sed 's/ as "/ '$2'\//' | 
sed 's/"/.swf/' | awk '{print " -o "$2" -i "$1}'>$TMPFILE`
i=1
cat $TMPFILE | while read line;
do
        `swfextract $line $1`   # extract sprites with the respective ID 
retrieved via swfdump
        `swfbbox -O $2/Page$i.swf`      # adjust bounding box to the sprite 
content
        `swfcombine -T -z emptyAS3.swf $2/Page$i.swf -o $2/Page$i.swf`  # 
convert AVM1 swf to AVM2
        ((i+=1))
done
rm $TMPFILE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]