|
#1
| |||
| |||
| Help Needed In Flash! Very Important! Need Quick! i am using the Flash MX trial and i need help... i need to know (in detail) how to insert an audio file and make a pause and play button control the audio (in case someone would get annoyed) any help would be appreciated! even if you have flash 4 or 5 it would probably work... please help!!!!!! anyone with flash experience wanted! Last edited by BlingBling 3k12; March 17th, 2002 at 01:24 PM. |
|
#2
| ||||
| ||||
| from acromedia flash help, sound objects Creating sound controls You use the built-in Sound object to control sounds in a movie. To use the methods of the Sound object, you must first create a new Sound object. Then you can use the attachSound method to insert a sound from the library into a movie while the movie is running. To see an animated demonstration of sound controls, click the Play button and adjust the volume and pan. The Sound object's setVolume method controls the volume, and the setPan method adjusts the left and right balance of a sound. The following procedures show how to create sound controls like the ones shown above. * To attach a sound to a Timeline: 1 Choose File > Import to import a sound. 2 Select the sound in the library, right-click, and choose Options > Linkage. 3 Select Export for ActionScript and Export in first frame; then give it the identifier a_thousand_ways. 4 Add a button to the Stage and name it playButton. 5 Add a button to the Stage and name it stopButton. 6 Add a movie clip to the Stage and name it speaker. 7 Select frame 1 in the main Timeline and choose Window > Actions. 8 To pause the movie until the user selects Play, in the Actions toolbox, click the Objects category, click Movie, Sound, and Methods, and double-click stop. Enter _root.speaker in the Object text box. 9 To create a new Sound object, in the Actions toolbox, click the Objects category, click Movie, click Sound, and double-click new Sound. Enter song = in the Expression text box. 10 In the Actions toolbox, click the Objects category, click Movie, Sound, and Methods, and double-click attachSound. Enter song in the Object text box and "a_thousand_ways" (including the quotation marks) in the Parameters text box. 11 To start the song, in the Actions toolbox, click the Objects category, then click Movie, Sound, and Methods, and double-click start. 12 To activate the speaker, in the Actions toolbox, click the Objects category, then click Movie, Movie Clip, and Methods, and double-click play. Enter _root.speaker in the Object text box. Your code should look like this: _root.speaker.stop(); song = new Sound(); song.attachSound("a_thousand_ways"); _root.playButton.onRelease = function() { song.start(); _root.speaker.play(); }; 13 To stop the speaker when the song ends, click the Objects category, then click Movie, Sound, and Events, and double-click onSoundComplete. Enter song in the Object text box. Enter onSoundComplete in the Method text box. 14 In the Actions toolbox, click the Objects category, click Movie, Sound, and Methods, and double-click stop. Enter _root.speaker in the Object text box. Your code should look like this: _root.speaker.stop(); song = new Sound(); song.attachSound("a_thousand_ways"); _root.playButton.onRelease = function() { song.start(); _root.speaker.play(); song.onSoundComplete = function() { _root.speaker.stop(); }; }; 15 Choose Control > Test Movie to hear the sound. * To create a sliding volume control: 1 Drag a button to the Stage. 2 Select the button and choose Insert > Convert to Symbol. Be careful to choose the movie clip behavior. This creates a movie clip with the button on its first frame. 3 Select the movie clip and choose Edit > Edit Symbol. 4 Select the button and choose Window > Actions. 5 Enter the following actions: on (press) { startDrag("", false, left, top, right, bottom); } on (release) { stopDrag(); } The startDrag parameters left, top, right, and bottom are variables set in a clip action. 6 Choose Edit > Edit Document to return to the main Timeline. 7 Select the movie clip on the Stage. 8 Enter the following actions: onClipEvent (load) { top = _y; bottom = _y; left = _x; right = _x+100; _x += 100; } onClipEvent (enterFrame) { _root.song.setVolume(_x-left); } 9 Choose Control > Test Movie to use the volume slider. * To create a sliding balance control: 1 Drag a button to the Stage. 2 Select the button and choose Insert > Convert to Symbol. Choose the movie clip property. 3 Select the movie clip and choose Edit > Edit Symbol. 4 Select the button and choose Window > Actions. 5 Enter the following actions: on (press) { startDrag ("", false, left, top, right, bottom); dragging = true; } on (release, releaseOutside) { stopDrag (); dragging = false; } The startDrag parameters left, top, right, and bottom are variables set in a clip action. 6 Choose Edit > Edit Document to return to the main Timeline. 7 Select the movie clip on the Stage. 8 Enter the following actions: onClipEvent(load){ top=_y; bottom=_y; left=_x-50; right=_x+50; center=_x; } onClipEvent(enterFrame){ if (dragging==true){ _root.s.setPan((_x-center)*2); } } 9 Choose Control > Test Movie to use the balance slider.
__________________ I'm a product of my imagination. |
|
#3
| ||||
| ||||
|
__________________ I'm a product of my imagination. |
|
#4
| ||||
| ||||
| why not just use movie clips? tell target and start and stop a empty movie clip. simple.
__________________ Current Setup: Quicksilver G4 733mhz ? OSX 10.2.4 ? 640mb ram ? 120 GB total HD space ? 19" LaCie Monitor ? Wacom Intuos Tablet ? Agfa Snapscan ? Canon BjC-2100 Printer ? Sony Digital 8 Camcorder ? Fuij FinePix Camera |
|
#5
| ||||
| ||||
| are u shure the movie clip should be empty? should it not have the sound file in it?
__________________ I'm a product of my imagination. |
|
#6
| ||||
| ||||
| yes, sorry, i thought that was inferred... the movie clips should have sounds files in one of the frames.
__________________ Current Setup: Quicksilver G4 733mhz ? OSX 10.2.4 ? 640mb ram ? 120 GB total HD space ? 19" LaCie Monitor ? Wacom Intuos Tablet ? Agfa Snapscan ? Canon BjC-2100 Printer ? Sony Digital 8 Camcorder ? Fuij FinePix Camera |
|
#7
| ||||
| ||||
| is this guy listening to what we said?
__________________ I'm a product of my imagination. |
|
#8
| ||||
| ||||
| Using a movie clip is the technique I use all the time. It works out very well... the code is simple. Just create a movie clip for each sound, each clip holds one sound and use tellTarget command to start, and stop the desired movie clip. Am I missing something here? This seems too simple.
__________________ //evildan |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Flash help needed! | monktus | Design & Media | 1 | November 25th, 2003 12:47 PM |
| Flash Expert Needed ! | Nummi_G4 | Mac OS X System & Mac Software | 12 | October 9th, 2003 07:15 PM |
| Flash Font Issues | evildan | Mac OS X System & Mac Software | 8 | July 24th, 2003 08:11 AM |
| Flash MX Bug IN OSX.2 | slo | Opinions, & Open Letters | 8 | November 11th, 2002 07:24 PM |
| I want to hear from you | designer | Apple News, Rumors & Discussion | 25 | November 13th, 2001 12:04 PM |