Skip to content

Instantly share code, notes, and snippets.

@ngs
Created October 8, 2010 21:38
Show Gist options
  • Save ngs/617609 to your computer and use it in GitHub Desktop.
Save ngs/617609 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<swf version="4" compressed="0">
<Header framerate="24" frames="2">
<size>
<Rectangle left="0" right="4800" top="0" bottom="7000"/>
</size>
<tags>
<SetBackgroundColor>
<color>
<Color red="255" green="255" blue="255"/>
</color>
</SetBackgroundColor>
<DefineFont2 objectID="1" isShiftJIS="1" isUnicode="0" isANSII="0" wideGlyphOffsets="0" italic="0" bold="0" language="0" name="_ゴシック">
<glyphs/>
</DefineFont2>
<DefineEditText objectID="2" wordWrap="0" multiLine="0" password="0" readOnly="1" autoSize="0" hasLayout="1" notSelectable="0" hasBorder="0" isHTML="0" useOutlines="0" fontRef="1" fontHeight="240" align="0" leftMargin="0" rightMargin="0" indent="0" leading="40" variableName="testText">
<size>
<Rectangle left="-40" right="3780" top="-40" bottom="430"/>
</size>
<color>
<Color red="38" green="40" blue="179" alpha="255"/>
</color>
</DefineEditText>
<PlaceObject2 replace="0" depth="1" objectID="2">
<transform>
<Transform transX="459" transY="790"/>
</transform>
</PlaceObject2>
<DefineBitsJPEG2 objectID="3">
<data>
<data>[% img %]</data>
</data>
</DefineBitsJPEG2>
<DefineShape objectID="4">
<bounds>
<Rectangle left="217" right="4742" top="1397" bottom="5364"/>
</bounds>
<styles>
<StyleList>
<fillStyles>
<ClippedBitmap objectID="65535">
<matrix>
<Transform scaleX="20.00000000000000" scaleY="20.00000000000000" transX="0" transY="0"/>
</matrix>
</ClippedBitmap>
<ClippedBitmap objectID="3">
<matrix>
<Transform scaleX="102.8372192382812" scaleY="123.9614868164062" transX="217" transY="1397"/>
</matrix>
</ClippedBitmap>
</fillStyles>
<lineStyles/>
</StyleList>
</styles>
<shapes>
<Shape>
<edges>
<ShapeSetup x="4742" y="5364" fillStyle1="2"/>
<LineTo x="-4525" y="0"/>
<LineTo x="0" y="-3967"/>
<LineTo x="4525" y="0"/>
<LineTo x="0" y="3967"/>
<ShapeSetup/>
</edges>
</Shape>
</shapes>
</DefineShape>
<PlaceObject2 replace="0" depth="2" objectID="4">
<transform>
<Transform transX="0" transY="0"/>
</transform>
</PlaceObject2>
<ShowFrame/>
<DoAction>
<actions>
<PushData>
<items>
<StackString value="testText"/>
</items>
</PushData>
<PushData>
<items>
<StackString value="[% hoge %]"/>
</items>
</PushData>
<SetVariable/>
<EndAction/>
</actions>
</DoAction>
<ShowFrame/>
<End/>
</tags>
</Header>
</swf>
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
use SWF::Generator;
use MIME::Base64;
use LWP::UserAgent;
use HTTP::Request::Common;
my $q = CGI->new;
my $swfgen = SWF::Generator->new(
swfmill_option => [qw/-e cp932/],
);
my $img = $q->param('img') || 'http://www.google.com/images/google_sm.gif';
my $ua = LWP::UserAgent->new;
my $req = GET($img);
my $res = $ua->request($req);
my $img_b64 = encode_base64($res->content);
$img_b64 =~ s/\r|\n//g;
my $stash = {
hoge => $q->param('hoge') || "aいうえお",
img => $img_b64,
};
my $swf = $swfgen->process('mobile.xml',$stash);
print $q->header( -type=>'application/x-shockwave-flash' );
#print $q->header('text/html');
print $swf;
exit;
#!/bin/sh
swfmill -e cp932 swf2xml mobile.swf > mobile.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment