swftools-common
[Top][All Lists]
Advanced

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

Re: [Swftools-common] Re: stereo sound(track)


From: iosif budulai
Subject: Re: [Swftools-common] Re: stereo sound(track)
Date: Tue, 13 Jul 2010 20:17:47 -0700 (PDT)

Hi Russ,
Here is the mp3 player as simple as it can get [put the code bellow into a file foo.sc]:

.flash filename="sound.swf" fps=24 bbox=100x40 background="" version=8 

.box play width=20 height=20 line=0 fill=blue
.box stop width=20 height=20 line=0 fill=red

.button bt_play 
.show play as=area
.show play as=idle
.show play as=hover y=-1
.on_press:
_root.play();
.end
.end

.button bt_stop
.show stop as=area
.show stop as=idle
.show stop as=hover y=-1 
.on_press:
_root.stop();
.end
.end

.put bt_play 15 10
.put bt_stop 40 10

.action:
song = new Sound();
song.loadSound("dust.mp3", true);

function play(){
song.start();
};

function stop(){
song.stop();
};

.end #end of action

.end

So explaining that code:
-first line creates a file sound.swf [after compiling swfc foo.sc]
-after create 2 rectangles 20x20 pixels play and stop one blue and other red
-create 2 buttons one for play and one for stop using on press action for those buttons trigger their respective functions 
-put the buttons at a certain position
-in between the action:/end tags are the actionscript 2 code
   -create a new sound object called song [you can name it whatever you want]
   -next line load the mp3 song into that object [put your mp3 file name in here and the file have to be in the same folder as the foo.sc file]
   -function start tells to object song to start and function stop tells to object song to stop

To play that file into any browser do this:
Put the flowing code into a file player.html in the same folder withe the compiled sound.swf file:

<html>
<head>

</head>
<body>

<table border="0" bgcolor="black" width=100% height=100%>
<tr>
<td align="center">

<object width="100" height="40">
<param name=quality value=high>
<param name="movie" value="sound.swf">
<embed src="" width="100" height="40">
</embed>
</object>

</td>
</tr>
</table>

</body>
</html>

Drag the player.html in any browser and the song should start automatically. In the middle of the page you should have a blue and a red button.

I use swftools-0.9.0 and works on windows and linux too.
If you follow the steps it should work. Take it from here and you can do just about everything

Hope helps.

Regards,
Iosif

From: Chris Pugh <address@hidden>
To: Russell Lyons <address@hidden>
Cc: address@hidden
Sent: Tue, July 13, 2010 6:16:42 PM
Subject: Re: [Swftools-common] Re: stereo sound(track)

Russ,

>On 13 July 2010 16:48, Russell Lyons <address@hidden> wrote:
> Let me answer the various questions in order.

>> Do you really have to combine your soundtrack ( wav/mp3 ) and the video
>> swf into one large file??   Would it not be better to load/stream/control
>> them independently?  Might make life a whole lot easier.
>
> I would like to combine them in order to then create other formats (such
> as flv). However, that is not necessary. I don't know how to control
> playback of both sound and video simultaneously.

flv playback is not straightforward.  You'll need the Adobe flv component.
Would it not be better to take advantage of some of the Open source
players out there, and simply embed them?

>> You can't mix frame rates in the root movie.   Master takes precedence.
>
> I don't think I tried to. There was only 1 frame rate (only 1 video).

I was referring to swf combination with swfcombine.

> You can see what I made at
> http://mypage.iu.edu/~rdlyons/rw/ustpeano.html with explanations and
> other formats at http://mypage.iu.edu/~rdlyons/rw/rw.html
> I did not use swftools for any of this, though I'd like to.

Very unteresting.  For which bit do you wish to use it?

> Concerning the buttons sc file that Iosif sent, I tried to compile it

Sorry, I didn't look at it.  You'll have to ask Iosef what he did.

If you want to have a play with some musings on sound playback
with swfc, here you go,

  http://www.nordberg.me.uk/swfc_samples/

A tad old now, but the as2/swf/mp3 files are there for you to
experiment with.

> Finally, I don't know ActionScript, so wouldn't know how to use
> attachSound.

Practice? ;o)  Take a look at the examples mentioned above.  I've
loaded the sounds in several ways.  loadSound is probably better
choice, since you can then choose to stream.

If you can do sound, you can do video.  Streaming an swf or two
inside another is pretty straightforward.

Let us know how you get on.

Regards,



Chris.



reply via email to

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