logo       

RE: Embedding mp3: msg#00046

web.ming.general

Subject: RE: Embedding mp3

Instead of calling swf through headers call through object.

Your code worked for me minus changing to my own local fdb font and mp3
And the loop count is respectively written within the swf as in
increments.


<?php
Ming_setScale(1.0);
Ming_useSWFVersion(6);

$mp3URL = 'Coldplay - Live - Daylight.mp3';

$f = new SWFFont("ParkAvenue BT.fdb");

$m = new SWFMovie();
$m->setDimension(20,20);
$m->setBackground(0xff, 0xff, 0xff);

$t = new SWFTextField(SWFTEXTFIELD_NOEDIT | SWFTEXTFIELD_NOSELECT );
$t->setName("statusTxt");
$t->setFont($f);
$t->setColor(0x00, 0x00, 0x00);
$t->setHeight(12);
$t->addString('1');
$xt = $m->add($t);
$xt->setDepth(10);
$xt->setName('status');
$xt->moveTo(1,1);

$m->add(new SWFAction("
var loops = 1;
sndClip1=new Sound();
sndClip1.loadSound('$mp3URL',true);
sndClip1.setVolume(100);
sndClip1.start();
sndClip1.onSoundComplete = function () {
sndClip1.start();
loops +=1;
_root.statusTxt = loops;
};
"));

$m->save("streammp3mx.swf",9);

// header('Content-type: application/x-shockwave-flash');
// $m->output(9); //Compression Level 0...9
?>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4
,0,0,0" ID=objects WIDTH=468 HEIGHT=60>
<PARAM NAME=movie VALUE="streammp3mx.swf">
<EMBED src="streammp3mx.swf" WIDTH=468 HEIGHT=60
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_P
rod_Version=ShockwaveFlash">
</OBJECT>


Barry Cordingley


-----Original Message-----
From: ming-fun-bounces@xxxxxxxxxx [mailto:ming-fun-bounces@xxxxxxxxxx]
On Behalf Of Darren Cook
Sent: Tuesday, December 30, 2003 2:53 AM
To: ming-fun@xxxxxxxxxx
Subject: Re: [ming-fun] Embedding mp3

>>I'd like to embed a few mp3 files in a swf (as opposed
>> to streaming mp3).

Dave wrote:
> You can do it like this using the 0.3a CVS version.

Belated thanks for the replies. I've got Ming properly installed now and
managed to run the examples using PHP. The numbers don't appear by the
way
(I tried a few variations on _root.status=... but no luck yet).

More importantly to me, this example does not embed the mp3: the
produced
file is only 267 bytes, and if I delete the mp3 file after compiling it
fails to play anything.

In contrast when I do this with the Flash authoring tool, with the same
mp3
file, I get a 133Kb swf file. Is it possible to do the same with Ming?

Darren


> <?
> Ming_setScale(1.0);
> Ming_useSWFVersion(6);
>
> $mp3URL = 'distortobass.mp3';
>
> $f = new SWFFont("Arial.fdb");
>
> $m = new SWFMovie();
> $m->setDimension(20,20);
> $m->setBackground(0xff, 0xff, 0xff);
>
> $t = new SWFTextField(SWFTEXTFIELD_NOEDIT | SWFTEXTFIELD_NOSELECT );
> $t->setName("statusTxt");
> $t->setFont($f);
> $t->setColor(0x00, 0x00, 0x00);
> $t->setHeight(12);
> $t->addString('1');
> $xt = $m->add($t);
> $xt->setDepth(10);
> $xt->setName('status');
> $xt->moveTo(1,1);
>
> $m->add(new SWFAction("
> var loops = 1;
> sndClip1=new Sound();
> sndClip1.loadSound('$mp3URL',true);
> sndClip1.setVolume(100);
> sndClip1.start();
> sndClip1.onSoundComplete = function () {
> sndClip1.start();
> loops +=1;
> _root.statusTxt = loops;
> };
> "));
>
> $m->save("streammp3mx.swf",9);
>
> //header('Content-type: application/x-shockwave-flash');
> //$m->output(9); //Compression Level 0...9
> ?>


_______________________________________________
ming-fun mailing list
ming-fun@xxxxxxxxxx
http://www.opaque.net/mailman/listinfo/ming-fun


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise