Sound Controlled Switch

Do you find any way to control the sound included in your movie? You can first import sound to the timeline of movie clip and then control the sound by controlling the movie clip. Another widely used way is to use ActionScript to bind sound in the library. I will focus on showing you this method. Take earphotos and control the music. 
 

 

Series: SWF Quicker 2.0

1. Launch SWF Quicker and import a sound file.



2. Right-click the sound file in library and select Linkage in the pop-up box. Set Identifier as sound.



3. Use text tool to write "sound stop" on the canvas and set the Var as btnText. Convert it to button, enter btnSound as instance name in properties panel.



4. Add a dynamic text block, which shows current play position information on the canvas and set its Var as curPos.



5. Add following ActionScript in frame 1 of main movie.

Code:
ss=new Sound();       //cods for bound sound;
ss.attachSound("sound");
ss.start();
soundPlaying = true;//set current play state;
function onEnterFrame() {
   curPos = ss.position+"ms";   //take millisecond as unit to show current sound position;
}


6. Add following ActionScript in button



Code:
on (release) {
   if (soundPlaying == true) {
       ss.stop();
       _root.soundPos=ss.position;//write current playback position
       this.btnText = "Sound Start";
       soundPlaying = false;
   }else{
       ss.start(_root.soundPos/1000);//continue playing from pause position;
       this.btnText = "Sound Stop";
       soundPlaying = true;
   }
}

 

See more details, click soundCtrl.rar (695.98 KB) to download source file.

Back to Top >>

 

Home

Sothink is a trademark of SourceTec Software Co., LTD.
Sothink Software: SWF Decompiler Flash to HTML5 Logo Maker Logo Design Software Mac Decompiler Video Converter

1234