Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author: Nick Kouvaris
»  Title: Znax
»  Description: Znax is a board game. Click 4 tiles of the same color and form squares as big as you can. You will erase all the tiles inside the square and collect points. Get maximum score if you make a square with game edges.
»  More by: Nick Kouvaris


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

Featured Site

»  Author Agence WOP Digital Agency
»  Title: Electricdrum
»  Description: French WOP Agency, 3D websites, Flash (Papervision, Away 3D), event or institutional projects. The agency operates on all digital projects: consulting, design, graphic design, development, online communication. The WOP agency follows you on the implementation of original, creative and optimized digital projects.


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

» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» How To Make A Fathers Day Slideshow
» How To Make A Transparent Background of Your Flash File
» Create Flash Banner With Text Disco Light Effect Today we will introduce you a Text Disco Light eff
» Unknown Tag: Title10
Random Tutorial | Add Site


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

Search Tutorials


Tutorials Tutorials » Audio

Categories Flash MX Sound Object Tutorial
Author: Kenny Bellew

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

How to Build a Horizontal Volume Slider

Fig. 06: Example of 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.
  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%.
  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):

    onClipEvent(load) {    
    left=(_root.hslider._x) - 50;
    //The above allows the slider to slide 50 pixels to the left

    top=_root.base._y + 1.1;
    // Replace or remove the 1.1 with whatever pixel number
    //you need to fine tune placement.

    right=(_root.hslider._x) + 50;
    //The above allows the slider to slide 50 pixels to the right.

    bottom=_root.base._y + 1.1;
    // The bottom should equal the "top" value to remove any
    //vertical movement from the slider.

    _root.hslider._x=_root.base._width/2;
    //Loads the slider exactly in the middle of the base.

    volCalc=_root.hslider._x-50
    //Above establishes pixel range for calculating volume
    //End of onClipEvent load

    onClipEvent(enterFrame) {
    // This constantly sets the current x-axis position of
    //the slider to "sliderx" and then sets the volume to
    //the x-axis value - volCalc.

    sliderx=_root.hslider._x;
    myMusicVolume=(sliderx-volCalc);
    _root.myMusic.setVolume(myMusicVolume);
    _root.currentVolume=_root.myMusic.getVolume();
    //Displays volume in dynamic text box with the Var name of currentVolume..
    //End of onClipEvent enterFrame
    }
    onClipEvent(mouseDown) {
    startDrag(this, false, left , top , right, bottom)
    }
    //
    onClipEvent(mouseUp) { this.stopDrag();
    }

    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 () { code here}

    Use whatever is most convenient.

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

» Level Intermediate

Added: : 2002-08-13
Rating: 9.11 Votes: 662
Hits: 3054
» Author
Kenny Bellew is a technical writer in Minneapolis, MN. He's currently interested in becoming involved in other writing-related Flash projects.
» Download
Download the files used in this tutorial.
Download (6170 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