image
image

|


Go Back   macosx.com > Design, Media, Programming & Scripting > Design & Media

Reply
 
Thread Tools
  #1  
Old March 17th, 2002, 12:08 PM
Somewhere... dunno though
 
Join Date: Dec 2001
Location: Somewhere!
Posts: 1,634
Thanks: 0
Thanked 0 Times in 0 Posts
BlingBling 3k12 is on a distinguished road
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.
Reply With Quote
  #2  
Old March 17th, 2002, 03:23 PM
vic's Avatar
vic vic is offline
RRRrrrRRRrrrRRrrr
 
Join Date: Apr 2001
Location: Canada EH!
Posts: 748
Thanks: 0
Thanked 0 Times in 0 Posts
vic is on a distinguished road
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.
Reply With Quote
  #3  
Old March 17th, 2002, 06:03 PM
vic's Avatar
vic vic is offline
RRRrrrRRRrrrRRrrr
 
Join Date: Apr 2001
Location: Canada EH!
Posts: 748
Thanks: 0
Thanked 0 Times in 0 Posts
vic is on a distinguished road
heres another one:

book mark this site:

http://www.flashkit.com/tutorials/In...72/index.shtml
__________________
I'm a product of my imagination.
Reply With Quote
  #4  
Old March 18th, 2002, 12:45 AM
rinse's Avatar
www.visualrinse.com
 
Join Date: Sep 2000
Location: Chicago
Posts: 777
Thanks: 0
Thanked 0 Times in 0 Posts
rinse is on a distinguished road
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
Reply With Quote
  #5  
Old March 18th, 2002, 07:03 AM
vic's Avatar
vic vic is offline
RRRrrrRRRrrrRRrrr
 
Join Date: Apr 2001
Location: Canada EH!
Posts: 748
Thanks: 0
Thanked 0 Times in 0 Posts
vic is on a distinguished road
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.
Reply With Quote
  #6  
Old March 20th, 2002, 04:46 PM
rinse's Avatar
www.visualrinse.com
 
Join Date: Sep 2000
Location: Chicago
Posts: 777
Thanks: 0
Thanked 0 Times in 0 Posts
rinse is on a distinguished road
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
Reply With Quote
  #7  
Old March 20th, 2002, 05:31 PM
vic's Avatar
vic vic is offline
RRRrrrRRRrrrRRrrr
 
Join Date: Apr 2001
Location: Canada EH!
Posts: 748
Thanks: 0
Thanked 0 Times in 0 Posts
vic is on a distinguished road
is this guy listening to what we said?
__________________
I'm a product of my imagination.
Reply With Quote
  #8  
Old March 20th, 2002, 09:16 PM
evildan's Avatar
Super Moderator
 
Join Date: Oct 2001
Location: Madison, WI
Posts: 1,075
Thanks: 0
Thanked 0 Times in 0 Posts
evildan is on a distinguished road
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
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

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


All times are GMT -5. The time now is 07:28 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.