;

PDA

Click to See Complete Forum and Search --> : Music help needed


ltouhig
01-04-2002, 09:26 AM
I am trying to create a simple music on/off icon in koolmoves. I want the music file to come on on mouse press and off on next mouse press. Seems simple but I just can't get it!
I have tried with sound file associated with the first frame and none on second frame. Is this corect. If so how do I get it to come back on?

Thanks in advance.

Lee

Bob Hartzell
01-04-2002, 11:10 AM
I am going to give you partial advice and let others fill in the blanks. The easiest way I can see to do this is by using action scripting on a button. Something like:

on (release)
{
var flag;

if (playflag)
{
.. not sure what to put here
flag = false;
}

if (!playflag)
{
.. not sure what to put here
flag = true;
}

playflag = flag;
}

this could use if else or return capability.

johnie
01-04-2002, 04:55 PM
There are actually two ways to do this. The hard way and the easy way. The hard way is this:

This is how you would do this in Flash 5 http://www.flash5actionscript.com/soundobject.php


Before your Mouse in a Frame action you will do this:

soundname= new sound;
soundname.attachSound("Name of sound in Koolmoves");

Okay;

On the Mouse

On(release)
{Flag+=1;
if(flag==1){soundname.start(offset,loop times);
if(Flag==2){soundname.stop(offset,loop times);
Flag=0;}}

Okay Now the Easy way:

Create a SWF with nothing but your sound in it. export it as sound.swf, and save it to the same directory as your new SWF

On(release){Flag+=1;
if(Flag==1){loadMovie("sound.swf","_level1")};
if(Flag==2){unloadMovie("_level1");StopAllSounds();Flag=0}}
[Edited by johnie on 01-04-2002 at 05:04 PM]