use SWF::Element;
use SWF::File;

die "This script creates 'fizz261.swf' SWF file. A new file name is needed.\n" unless $ARGV[0];

$new = SWF::File->new("$ARGV[0].swf", Version => 6);

# fizz261.swf  SWF header

$new->FrameSize(0, 0, 2080, 2080);
$new->FrameRate(12);
#$new->FrameCount(1);

# fizz261.swf  SWF tags

# Tag No.: 0
SWF::Element::Tag::SetBackgroundColor->new(
    BackgroundColor => SWF::Element::RGB->new(
        Red => 51,
        Green => 51,
        Blue => 51,
    ),
)->pack($new);
# Tag No.: 1
SWF::Element::Tag::DoAction->new(
    Actions => SWF::Element::Array::ACTIONRECORDARRAY->new([

        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            LocalLabel => "F",
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("100"),			# 0
                SWF::Element::ACTIONDATA::String->new("i"),			# 1
                SWF::Element::ACTIONDATA::String->new("i"),			# 2
                SWF::Element::ACTIONDATA::String->new("i"),			# 3
            ]),
        ),			# 2
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 3
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionIncrement',
        ),			# 4
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionSetVariable',
        ),			# 5
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 6
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionLess',
        ),			# 7
        SWF::Element::ACTIONRECORD::ActionIf->new(
            Tag => 'ActionIf',
            BranchOffset => "A#166",
        ),			# 8
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("x"),			# 0
                SWF::Element::ACTIONDATA::String->new("x"),			# 1
            ]),
        ),			# 9
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 10
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("i"),			# 0
            ]),
        ),			# 11
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 12
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionPushDuplicate',
        ),			# 13
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("15"),			# 0
            ]),
        ),			# 14
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionDivide',
        ),			# 15
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionToInteger',
        ),			# 16
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("15"),			# 0
            ]),
        ),			# 17
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionMultiply',
        ),			# 18
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionSubtract',
        ),			# 19
        SWF::Element::ACTIONRECORD::ActionIf->new(
            Tag => 'ActionIf',
            BranchOffset => "B#18",
        ),			# 20
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("FizzBuzz"),			# 0
            ]),
        ),			# 21
        SWF::Element::ACTIONRECORD::ActionJump->new(
            Tag => 'ActionJump',
            BranchOffset => "C#93",
        ),			# 22
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            LocalLabel => "B",
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("i"),			# 0
            ]),
        ),			# 23
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 24
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionPushDuplicate',
        ),			# 25
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("5"),			# 0
            ]),
        ),			# 26
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionDivide',
        ),			# 27
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionToInteger',
        ),			# 28
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("5"),			# 0
            ]),
        ),			# 29
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionMultiply',
        ),			# 30
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionSubtract',
        ),			# 31
        SWF::Element::ACTIONRECORD::ActionIf->new(
            Tag => 'ActionIf',
            BranchOffset => "D#14",
        ),			# 32
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("Buzz"),			# 0
            ]),
        ),			# 33
        SWF::Element::ACTIONRECORD::ActionJump->new(
            Tag => 'ActionJump',
            BranchOffset => "C#50",
        ),			# 34
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            LocalLabel => "D",
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("i"),			# 0
            ]),
        ),			# 35
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 36
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionPushDuplicate',
        ),			# 37
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("3"),			# 0
            ]),
        ),			# 38
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionDivide',
        ),			# 39
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionToInteger',
        ),			# 40
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("3"),			# 0
            ]),
        ),			# 41
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionMultiply',
        ),			# 42
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionSubtract',
        ),			# 43
        SWF::Element::ACTIONRECORD::ActionIf->new(
            Tag => 'ActionIf',
            BranchOffset => "E#14",
        ),			# 44
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("Fizz"),			# 0
            ]),
        ),			# 45
        SWF::Element::ACTIONRECORD::ActionJump->new(
            Tag => 'ActionJump',
            BranchOffset => "C#7",
        ),			# 46
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            LocalLabel => "E",
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new("i"),			# 0
            ]),
        ),			# 47
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionGetVariable',
        ),			# 48
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionStringAdd',
            LocalLabel => "C",
        ),			# 49
        SWF::Element::ACTIONRECORD::ActionPush->new(
            Tag => 'ActionPush',
            DataList => SWF::Element::Array::ACTIONDATAARRAY->new([
                SWF::Element::ACTIONDATA::String->new(" "),			# 0
            ]),
        ),			# 50
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionStringAdd',
        ),			# 51
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionSetVariable',
        ),			# 52
        SWF::Element::ACTIONRECORD::ActionJump->new(
            Tag => 'ActionJump',
            BranchOffset => "F#-193",
        ),			# 53
        SWF::Element::ACTIONRECORD->new(
            Tag => 'ActionEnd',
            LocalLabel => "A",
        ),			# 54
    ]),
)->pack($new);
# Tag No.: 2
SWF::Element::Tag::DefineEditText->new(
    CharacterID => 1,
    Bounds => SWF::Element::RECT->new(
        Xmin => 20,
        Ymin => 20,
        Xmax => 2040,
        Ymax => 2040,
    ),
    Flags => 2144,
    VariableName => "x",
)->pack($new);
# Tag No.: 3
SWF::Element::Tag::PlaceObject->new(
    CharacterID => 1,
    Depth => 1,
    Matrix => SWF::Element::MATRIX->new(
        ScaleX => 1,
        ScaleY => 1,
        RotateSkew0 => 0,
        RotateSkew1 => 0,
        TranslateX => 0,
        TranslateY => 0,
    ),
)->pack($new);
# Tag No.: 4
SWF::Element::Tag::ShowFrame->new(
)->pack($new);
#^------------------------------Frame No. 0 END.

# Tag No.: 5
SWF::Element::Tag::End->new(
)->pack($new);

$new->compress;

$new->close;

