A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Webmaster (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Audio

Categories How to Use Flash MX Sound Objects
Author: Kenny Bellew | Website: http://www.cowfly.com |

 
Page 10
«prev ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... next»

How to Build a Horizontal Volume Slider

  1. Create two images: the base of your slider interface and the image that will slide. If convenient, make the base of your slider 100 pixels wide, as the width would then correspond exactly to the volume range.
  2. Place both on stage as movie clips on separate layers. Place the base so that both axis's are on an integer (whole number).
  3. From the pull-down top menu, select "View" and then "Rulers".
  4. Place your slider image, exactly in the middle of the base. This point will represent volume at 50%. Place the slider so that both axis's are on an integer (whole number).
  5. Give your slider movie clip the instance name of "hslider".
  6. Select your slider movie clip, press F9 to access actions for the movie clip and add the following (of course, remove the "//" comments if desired):
Fig. 06: Example of horizontal volume slider
onClipEvent(load) {
this._x=_root.hbase._x + _root.hbase._width/2 - this._width/2;
left=this._x - _root.hbase._width/2;
top=this._y;
right=this._x + _root.hbase._width/2;
bottom=this._y;
volCalc=_root.hslider._x - _root.hbase._width/2
//
//End of Clip Event Load
}
//
onClipEvent(mouseDown) {
startDrag(this, false, left , top , right, bottom)
}
//
onClipEvent(mouseUp) {
this.stopDrag();
}
//
onClipEvent(enterFrame) {
// This constantly sets the current a-axis position of
//the slider to "sliderx
//
sliderx=_root.hslider._x; //Sets sliderx as variable for a-axis of slider
myMusicVolume=(sliderx-volCalc); //The value of x-axis load value - n = 50
_root.myMusic.setVolume(myMusicVolume);
_root.currentVolume="Volume " + _root.myMusic.getVolume();
}

In the above example, the slider movie clip can now be dragged from its center starting point to both ends of the base image. The variable "sliderx" is defined to equal the current x-axis point of your slider movie clip each time a frame is processed. The goal is to position your slider movie clip graphic so that its x-axis starts directly in the middle of the base. That way, you can calculate 50 pixels when the slider slides to the right and 50 pixels when it slides to the left.

The ActionScript for the above could also be placed in an event handler on a frame of any movie clip that loops such as:

this.onEnterFrame = function () {
//Your code here
}

Use whatever is most convenient.

«prev ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... next»

» Level Intermediate

Added: : 2004-10-12
Rating: 8.48 Votes: 31
Hits: 1290
» Author
Kenny Bellew is a technical writer and freelance flash programmer who specializes in Flash audio. He lives in Minneapolis, MN.
» Download
Download the files used in this tutorial.
Download (12927 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs