Need a script

Hello, I have two buttons: soundOFF and soundON.

What I need to do is that The movie should stay on the first frame where the button soundOFF is and a background sound is been played.

Once the user clicks on this button, the sound should stop and soundON  button should appear. And once the soundON is been clicked, the sound should start again and the button soundOFF should appear.  I think I should place this two buttons in different frames and use goto frame script somehow. Just last time I had to use flash, it was the version 3 and there werer no ASs ...

Would be greatful for any help,
Sherry
ShareeceAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ellandrdConnect With a Mentor Commented:
oops - sorry, myjavaserver seems to be offline... wierd!

here:

http://www.ukpegasus.co.uk/ellandrd/soundByEllandrd.html
http://www.ukpegasus.co.uk/ellandrd/ellandrd.zip

Ellandrd
0
 
ShareeceAuthor Commented:
Hello and thanks for the files, that's exactly what I need! Just I can't open the .fla file, get a runtime error message and flash ends immediately :(
I try and try, but don't success it. Would you please kindly write me the script?

Thanks!
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
ShareeceAuthor Commented:
I am using the flashMX, could it be the reason?
0
 
ellandrdCommented:
could be - im on flash 8.

maybe if you can follow my step by step guide - you can recreate my example??

1) create new flash document.
2) insert your sound in the library.
3) create new symbol MC ( MC = MovieClip) and name it "sounds".
4) open this MC up by double clicking on it from the library.
5) create 2 layers - 1 for the sound file and 1 for some actionscript.
6) on the first layer, drag your sound file on the stage.  extend this to say, keyframe 6.  in second layer on keyframe 6 press F6 to create blank keyframe.
7) while this blank keyframe is highlighted, open the "actions - frame" panel and add this actionscript code:

gotoAndPlay(1);

Note:  this will make the sound file loop continuously...

8) go back to main scene and create 3 layers: 1 for "sounds" movieclip, 1 for actionscript and 1 for buttons.
9) in the sounds layer, highlight/select keyframe 2 and drag your "sounds" movieclip from the library onto the stage
10) select the rectangle tool and create a button of your size.  select the text tool and give is a label like Sound Off.  Highlight both the text lablel and rectangle object and right-click and convert to symbol, selecting button and naming it "soundOFF".  
11) on the buttons layer, on keyframe 1, drag your button "soundOFF" onto the stage.
12) click on the button object on the stage and open the "actions - frame" again t add some actionscript code:

on(release)
{
      gotoAndPlay(2);
      _root.soundOFF._visible = true;
      _root.soundON._visible = false;
}

13) select the rectangle tool again and create another button giving it another label - called Sound On.  Again, like before, highlight both the label and rectangle and right-click and select convert to symbol, selecting button and nameing it "soundON"
14) on the buttons layer again, select keyframe 2 and drag your soundON button onto the stage covering soundOFF button.  e.g they overlap = 1 is hidden by the other
15) highlight "soundON" button and open "actions - frame" and add this actionscript code:

on(release)
{
      gotoAndPlay(1);
      _root.soundON._visible = true;
      _root.soundOFF._visible = false;
}

16) in the actionscripts layer - (3rd layer), in keyframe 1, add this code:

stop();

17) in the same layer again, select keyframe 2,and add this code again:

stop();

thats it!  test your movie.  you should get the "Sound On" button displaying first and when you click on it, it should run the "sounds" MC that plays your sound file over and over again.  notice when you click Sound On, the button is hidden and Sound Off button is how visible.  click Sound Off and the sound stops playing...

if you have followed this and still cant get it working, please tell me.  i'd also try again to open the .fla i send you.

Good luck! ;-)

ellandrd
0
 
ShareeceAuthor Commented:
Hi, I successed it :-)

My best Thanks,
Sherry
0
 
ellandrdCommented:
ah great - was my step my step guide any help?  was it easy to follow?

im glad you got it working ;-)

Sean
0
 
ShareeceAuthor Commented:
Yep, really great, your guide was my only help. I am very happy!

Your instructions are marvellous, detailed and easy to understand. You see, even me sucessed to make such complicated movie.
Do you want to see it? It's on the test server: http://eport.at/cs/html/index.html - It is almost ready to go online, there is just a little problem
with the flash movie and that is the white background that apears at the beginning, although I set the background color to one of the stage colors.
This is not good:(

Thank you again very much Sean,
My regards, sherry

 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.