Hi,
I put a sound file in a swf file, but I encountered a weird problem. It emitted a message like "Modification of a read-only value attempted" when I tried to use SWF::Sound->new.
My code is listed below. Hope someone can help. Thanks.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use SWF::Constants qw(SWFBUTTON_HIT SWFBUTTON_UP SWFBUTTON_DOWN SWFBUTTON_OVER);
use SWF qw(Action Bitmap Button Constants DisplayItem Fill Font Gradient Morph Movie MovieClip PrebuiltClip Shape Sound Text TextField);
sub main {
my $m = new SWF::Movie();
$m->setBackground(0xff,0xcc,0x0);
$m->setDimension(200,100);
my $b = new SWF::Button();
my $filename = 'snore.wav';
my $flag = SWF::Constants::SWF_SOUND_22KHZ | SWF::Constants::SWF_SOUND_8BITS | SWF::Constants::SWF_SOUND_MONO;
my $soundobject = SWF::Sound->new("snore.wav", $flag);
my $soundinstance = $b->addSound($soundobject, SWF::Constants::SWFBUTTON_HIT);
my $s = new SWF::Shape();
my $f = $s->addFill(0xff, 0, 0);
$s->setRightFill($f);
$s->movePenTo(0, 0);
$s->drawLineTo(20, 0);
$s->drawLineTo(20, 20);
$s->drawLineTo(0, 20);
$s->drawLineTo(0, 0);
$b->addShape($s, SWF::Constants::SWFBUTTON_HIT | SWF::Constants::SWFBUTTON_UP | SWF::Constants::SWFBUTTON_DOWN | SWF::Constants::SWFBUTTON_OVER);
$m->add($b);
$m->nextFrame();
$m->save("root/static/flash/empty.swf");
}
main(@ARGV);
Yung-chung Lin
I put a sound file in a swf file, but I encountered a weird problem. It emitted a message like "Modification of a read-only value attempted" when I tried to use SWF::Sound->new.
My code is listed below. Hope someone can help. Thanks.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use SWF::Constants qw(SWFBUTTON_HIT SWFBUTTON_UP SWFBUTTON_DOWN SWFBUTTON_OVER);
use SWF qw(Action Bitmap Button Constants DisplayItem Fill Font Gradient Morph Movie MovieClip PrebuiltClip Shape Sound Text TextField);
sub main {
my $m = new SWF::Movie();
$m->setBackground(0xff,0xcc,0x0);
$m->setDimension(200,100);
my $b = new SWF::Button();
my $filename = 'snore.wav';
my $flag = SWF::Constants::SWF_SOUND_22KHZ | SWF::Constants::SWF_SOUND_8BITS | SWF::Constants::SWF_SOUND_MONO;
my $soundobject = SWF::Sound->new("snore.wav", $flag);
my $soundinstance = $b->addSound($soundobject, SWF::Constants::SWFBUTTON_HIT);
my $s = new SWF::Shape();
my $f = $s->addFill(0xff, 0, 0);
$s->setRightFill($f);
$s->movePenTo(0, 0);
$s->drawLineTo(20, 0);
$s->drawLineTo(20, 20);
$s->drawLineTo(0, 20);
$s->drawLineTo(0, 0);
$b->addShape($s, SWF::Constants::SWFBUTTON_HIT | SWF::Constants::SWFBUTTON_UP | SWF::Constants::SWFBUTTON_DOWN | SWF::Constants::SWFBUTTON_OVER);
$m->add($b);
$m->nextFrame();
$m->save("root/static/flash/empty.swf");
}
main(@ARGV);
Yung-chung Lin
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Ming-users mailing list Ming-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/ming-users