Button Toggle In Flex
Does flex have a button toggle class or something???So once it has been clicked the function is disabled until another state is choosen<mx:LinkButton label="Value ('000s €)" click="changeState('01_wm_2');" icon="@Embed(source='assets/box_white.png')" styleName="dashButton" width="100%" height="22"/>Me thinks I am going to need to write it into changeState.anyone got a quick example from a previous experiment or something??cheers brndn
KirupaForum > Flash > ActionScript 3.0
Posted on: 10-08-2007, 07:04 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Flex Flex Button Question
Very basic question for the flex people.
How do you get rid of that very annoying blue rect round a button when you roll over it ?
I've tried about every style property in the Flex doc.
FLASH 8 - Toggle Button/released State/pressed Button
I have a series of buttons inside an array. I am trying to get the buttons so that once they are pressed, they remain in the over state. Which is a darker color than the up state. So that people know which button they have pressed. Is there an easy way to do this for buttons?
Please help someone,
Thanks,
M
Toggle Button
Hi guys,
I'm trying to create a toggle button that turns on/off a menu. I've tried a number of routes, including variables that are swapped when the button is pressed. i.e. if var=0 then display the menu and set var=1, if var=1 then hide the menu and set var=0. I cannot get this to work so if anyone has an idea then it would be greatly appreciated. p.s. I have the check to see what the variable is on the press action of the button and then swap the variable on the release action of the button.
Confused? I hope not.
Cheers
Keith
Toggle Button
I'm somewhat new to flash and I'm trying to create a pause button that toggles from pause to play. Here's the script I'm using on the button. It works but there's got to be a better way to do this. I admit, I suck at actionscript.
//brian
on (release) {
if (Number(button) == 2) {
tellTarget ("_root.MovieTest") {
play();
}
button = 1;
} else {
tellTarget ("_root.MovieTest") {
stop();
}
button = 2;
}
}
On/off Toggle Button
I have a button for turning music on and off. I see the command for stopallsounds, but I only want it to stop my background sound, not my mouseover sounds. And then I want it to turn the background sound back on the next time it is clicked (toggle).
Does this require an "if statement" of some sort?
Toggle Button
hi there,
is there any way to enable a button for toggle function???. on release, animation starts forward & on release again, animation starts backward
Please Help
Thanx in Advance
Rgds
Bhaskee
Toggle Button
I have a multi track player,and i need to toggle the mute on/off button according to the animation on the timeline.was wondering if its possible
some help would be nice
thanks
Toggle On/off Button
how do you create a toggle on/off button to display a movie clip
click to turn on....then click to turn off
Toggle Button
I need a button which toggles from on to off.....I've seen some examples out on the internet which but none of them are very easy to use.....do you have a simple toggle button script?
[F8] Flv Toggle Button
I am trying to create a button for my custom flv player that gives the user the ability to toggle between a hi res or low res flv.
The button (instance name = res)will at first be visible but when clicked it will load hi-res.flv and button will disappear
A new button(instance name res2)will appear and when clicked play low res.flv and son like a toggle.
I have the code to toggle between the two flvs but how do i make the buttons function as mentioned above.
Cheers in advance.
Here is my flv toggle code
[code=text]
var hiVer:Boolean = true;
function playFlik(filmName:String){
ns.play(filmName);
}
res.onRelease = function(){
if(hiVer){
//play hi version
playFlik("hiResMovie.flv");
//toggle
hiVer = false;
}
res2.onRelease = function(){
if(hiVer){
//play hi version
playFlik("hiResMovie.flv");
//toggle
hiVer = false;
[/code]
triad promotional merchandise business gifts suppler uk
Button Toggle Help
Is there a way to have one button control the state of another button? For instance I have a button named btn_home and I have another button on the stage called btn_homeTwo. I want when I roll over the btn_home for the btn_homeTwo button to go to its over state. Is there a way to do this. I tried.
PHP Code:
btn_home.onRollOver = function () {
btn_homeTwo.gotoAndStop(2);
}
and this did not work. Anyone have any Ideax
AS3 Toggle Button
Ok, I know, it sounds simple, but i'm trying to accomplish a button that will toggle it's funciton based on the position of an animated graphic.
To further explain, this button causes a graphic to animate up until "y" = 774,
then there is a funciton for the graphic animate back down.
The button executes the animation functions just fine, however I want the button function to change if said graphic is int the y=774 position.
I must state that I'm doing all this through an external actionscript file. I don't want to add any frames to the button graphic or any script except in the external .as file itself.
here is my code:
btn1.addEventListener("mouseDown", infoPanelDown);
function infoPanelDown(MouseEvent){
var myTween1:Tween = new Tween(infoPanel, "y", Strong.easeInOut, 464, 774, 50, false);//if true=seconds, false=frames
}
then when the same button is clicked again, I want the addEventListener to refrence the animation up function
I have tried "if" conditions, "do" contions, such as:
if (infoPanel.y==774){
btn1.addEventListener("mouseDown", infoPanelUp);
}
but no go...
any help here would be appreciated. Thank you.
-D
Toggle Button
I have 5 button with ID = but1, but2, but3, but4, but5
I want to loop the buttons and create a click event to toggle the alpha of the buttons.
but the following code doesn't work when looping each of the button IDs.
how can I loop each button and set a Key event toggle?
Code:
functALL = new Array ( but1, but2, but3, but4, but5 );
for ( i=0; i < functALL.length; i++){
functALL[i].onRelease = function (){
if (functALL[i]._alpha = 40 ){
functALL[i]._alpha = 100;
} else {
functALL[i]._alpha = 40;
}
}
}
Toggle Button
How can I create a toogle button using 2 frames to switch between.
Cheers.
Toggle Button
I am wanting to create toggle switches in actionscript 2.0 but have limited/no real knowledge of it. The website I am working on is www.car-parchitecture.com and the buttons I want to make into toggle switches can be found at the bottom right (the text)
The idea is that when the user clicks on one of the 4 buttons, the text will turn from grey to black, to indicate it has been selected and stay black whilst the user is on that particular page. When the user selects another page, the black text will return to its original state and the new selection will turn black.
Im very much a novice/idiot in Flash and an idiots guide to achieving the result would be immensly appreciated
Dan
www.car-parchitecture.com
Edited: 11/06/2008 at 12:37:06 PM by danfarrar
Toggle Button
I have 5 button with ID = but1, but2, but3, but4, but5
I want to loop the buttons and create a click event to toggle the alpha of the buttons.
but the following code doesn't work when looping each of the button IDs.
how can I loop each button and set a Key event toggle?
[CODE]
functALL = new Array ( but1, but2, but3, but4, but5 );
for ( i=0; i < functALL.length; i++){
functALL.onRelease = function (){
if (functALL._alpha = 40 ){
functALL._alpha = 100;
} else {
functALL._alpha = 40;
}
}
}
[/CODE]
Flv Toggle Button
I am trying to create a button for my custom flv player that gives the user the ability to toggle between a hi res or low res flv.
The button (instance name = res)will at first be visible but when clicked it will load hi-res.flv and button will disappear
A new button(instance name res2)will appear and when clicked play low res.flv and son like a toggle.
I have the code to toggle between the two flvs but how do i make the buttons function as mentioned above.
Cheers in advance.
Here is my flv toggle code
[code=text]
var hiVer:Boolean = true;
function playFlik(filmName:String){
ns.play(filmName);
}
res.onRelease = function(){
if(hiVer){
//play hi version
playFlik("hiResMovie.flv");
//toggle
hiVer = false;
}
res2.onRelease = function(){
if(hiVer){
//play hi version
playFlik("hiResMovie.flv");
//toggle
hiVer = false;
[/code]
triad promotional merchandise business gifts supplier uk
Toggle Button
Hello All:
Does anyone know how to create a simple toggle button to play and pause the time line? I've having trouble finding a tutorial, and would like to create one button that can play and pause without having to create two separate buttons.
Thanks.
Flv Toggle Button
I am trying to create a button for my custom flv player that gives the user the ability to toggle between a hi res or low res flv.
The button (instance name = res)will at first be visible but when clicked it will load hi-res.flv and button will disappear
A new button(instance name res2)will appear and when clicked play low res.flv and son like a toggle.
I have the code to toggle between the two flvs but how do i make the buttons function as mentioned above.
Cheers in advance.
Here is my flv toggle code
[code=text]
var hiVer:Boolean = true;
function playFlik(filmName:String){
ns.play(filmName);
}
res.onRelease = function(){
if(hiVer){
//play hi version
playFlik("hiResMovie.flv");
//toggle
hiVer = false;
}
res2.onRelease = function(){
if(hiVer){
//play hi version
playFlik("hiResMovie.flv");
//toggle
hiVer = false;
[/code]
triad promotional merchandise and business gifts supplier UK
http://www.triaduk.co.uk] triad prom...business gifts
Toggle Button
Hello All:
Does anyone know how to create a simple toggle button to play and pause the time line? I've having trouble finding a tutorial, and would like to create one button that can play and pause without having to create two separate buttons.
Thanks.
Toggle Button
Hi -
I'm really stuck with this. I have a simple button and I would like it to call one function when it's clicked for the first time, and another function when it's clicked for the second time.
Any ideas?
Toggle Button Help, Please.
I'm trying to make toggle buttons (with over 20 buttons) Here's what I'm trying to do:
When one button is clicked and hilights, the preceding button dims. Here's the code I'm using but as you can see, when I add numbers the code will become waaaay too long. There must be a better way to code this. Any help would be most welcome. Thanks Flashers!
ActionScript Code:
function myNumber() {
if (section == "one") {
_root.nav_mc.numbers_mc.two_mc.gotoAndStop(1);
_root.nav_mc.numbers_mc.three_mc.gotoAndStop(1);
}
if (section == "two") {
_root.nav_mc.numbers_mc.one_mc.gotoAndStop(1);
_root.nav_mc.numbers_mc.three_mc.gotoAndStop(1);
}
if (section == "three") {
_root.nav_mc.numbers_mc.one_mc.gotoAndStop(1);
_root.nav_mc.numbers_mc.two_mc.gotoAndStop(1);
}
trace("myNumbers");
}
Button Sound Toggle
I've posted this one before - hoping you can help this time
Can anyone explain to me a way to turn ALL my BUTTON sounds off using one toggle button?
I know how to control a sound object playing a background sound.... but what about the sounds which exist in the rollover and hit frames of my buttons???
I tried to dump all of the rollover sounds into a single clip - and play the relevent sound via an actionscript goto line. HOWEVER - it causes jumps and pauses in my menu animation. So... how the hell do I control the volume of these sounds?
Why the f**ck isn't there a universal volume control in Actionscript?????? And if there is, where the hell is it?.. and can you show me the way to a tutorial or open source fla so I can work it out? The only thing I can find is: stopAllSounds (); But, what about starting them again????
I've found squillions of tutorials about controlling sound... but not a single one which explains how to place and control button sounds. All the tutorials I've seen just blabber on about controlling a background sound (which is an easy one to solve) For some reason, it's going right over my head - but I bet it's as easy as hell once ya know how!! *LOL*
I'm stumped... can anyone help??
cheers.
Toggle Sound With One Button
Hey guys,
ive gone through the tutorials and everything, however, i could not find one that came to my specific needs. My flash movie has sound. it plays throughout the entire movie including each scene. however, im looking to make a toggle button to stop the music when they click it, and then if they want it on, click it again and the music will start again. I've thought of muting it, but then i cant restart the music when they want to hear it again. any suggestions?
Toggle Button Problem
hi,
I'd like to create a toggle button for example I've a button inside a mc...now if I click it'll zoom(that's ok) and the very next time I click it it'll go back to it's earlier position i.e. the button should work as a toggle button
Button Toggle Switch? Or What?
Ok so I have this nav bar right? There is a color bar with buttons on top of it. the default state for the bar is like 20% opacity when you mouse over it goes to 100% ok? with me so far? so thats fine... but if I have buttons over the bar when you mouse directly over the button the bar drops off... What would be the best way to do this?? heres what I have right now...
NavbarMC a simple MC with a tween fro 20% to 100% and from 100% to 20%.... and invisible button over the tope of this NavBarBUTTON.... send the comands... on rollover go to frame lable FadeIN on RollOUT go to frame label FadeOUT...yada yada... but of course when I mouse over the BUTTONS for navigation it resets the navbar back to 20%.... I basically want it at 100 when you are moused over the bar, and 20% when you roll off the bar... I'm thinking I should do this via opacity with action script? What do you guys think would be the best way to do it???
look here for an example of what I have done so far.
http://www.cafeboba.com/default2.asp
thanks peeps.
LoadSound Toggle Button
LOADSOUND
mySound = new Sound();
mySound.loadSound("mp3/intro/8.mp3",true);
mySound.onSoundComplete = function() {
nextScene();
}
I'm working on an introduction piece that has sound loaded with the code above (attached to first frame of a scene). I would like to script a button that would toggle this sound on/off using scripting only (one frame). I'm thinking some sort of if...else statement with mySound.start() and mySound.stop(). i'm a graphic designer and not much of an actionscript coder, and i need a little help getting started here. any help is appreciated. please contact me if you need additional info. here's my best guess
MY BEST GUESS
on (release) {
if (mySound.duration > 0) {
mySound.stop();
} else {
mySound.start();
}
}
A Simple Toggle Button In F5 Help
I'm trying to script a single button to alternately stop and play a timeline. I placed a var in frame 1. then coded the button:
on (release) {
if (_root.t = 0) {
stop ();
_root.t = 1;
} else {
play ();
_root.t = 0;
}
}
didn't work. Then tried to assign the var on an invisible movieclip used as a placeholder called "placeholder". changed the script reference to "placeholder.t" . Still nothing. I know this is fairly simple and doable. Anybody care to enlighten me?
doggbiterAP
Simple Toggle Button
Flash 5
I have a button to toggle the colour of a MC and 2 text boxes (box1 & box2. Each time I press the button I want the colour to change the MC and text to change.
on (release) {
if (a=!a) {
// button is off
box2 = "Off";
box1 = "";
colorTarget = new Color(colorTarget);
colorTarget.setRGB(0xff66ff);
} else {
// button is on
box1 = "On";
box2 = "";
colorTarget = new Color(colorTarget);
colorTarget.setRGB(0xffff66);
}
}
However, box2 and box1 work fine the colour of my Mc changes once then locks to that colour. Please tell me whats wrong with this script?
TIA for any help
Audio On/Off Toggle Button
I've created 2 seperate buttons that allow me to turn my background sound 'background01' on and off but I want to be able to do this with on button. I followed the instructions here http://www.flashkit.com/tutorials/Au...-824/index.php in order to set up my background sound. I used a movie clip with linkage in order to get the effects that I want but I just can't figure out the button
//On
on (press) {
if (playing!=true)
_root.background01.start(0,999);
playing=true;
}
//Off
on (release) {
_root.background01.stop("background01");
playing=false;
}
Any help would be sweet
Sound Toggle Button
I have a large training piece that is broken up into sections. Each section has it's own soundbyte. I'm wondering if there is an easy way to have a sound toggle button allowing users to turn the soundbytes on/off. Any ideas on how to code this?
Unpredictable Toggle Button
Hello,
I'm trying to make a toggle button that will change the text in a text box. I have tried a number of different approaches to get it to work smoothly, but it still seems to behaive unprictably.
on (release) {
if(textSet == 1){
buttonText = "Text set is equal to 1."
textSet = 0;
trace(textSet);
}else{
buttonText = "Text Set is equal to 0."
textSet = 1;
trace(textSet);
}
}
Sometimes it changes....other times it stays the same.
Is there something wrong with my code?
Any help is appreciated!
Toggle Button Question
Hi there, I've created a toggle button. Very simple. But, I want the toggle (if it is toggled) to stay UP whent the movie loops back again.
The toggle is for a command to LOOP the movie and stay looped. So it only makes sense to have the button stay toggled.
I had succeeded before by using an external swf file that the main movie was linked to, but now i have found that i can't use external swf files any longer.
Can you help?
Button To Toggle Visibility
I want to have various images appear over a background image. Each image will have a button that makes the image appear or disappear. does anyone have a .fla or some code I can look at?
Subtitle Toggle Button
So I'm making an animated video for my friend's song, with subtitles. It's in a simulated "widescreen" format, so I have black bars on the top and bottom of the movie window, and the subtitles show over the bottom black bar. I want to have a button at the top button bar which, when clicked, would turn the subtitles on and off. So basically, I need a button which will turn the visibility of my subtitles layer (which is called 'subtitles') to 0. Does anyone know of a script that I could attach to a button which could do this? I'm not so experienced with ActionScript so I would really appreciate anyone's help.
Thanks!
Toggle Button Woes...
Toggle button woes...
------------------------------------------------------------------------
Hi, this is my situation:
• my main timeline, which consists of 1 FRAME contains a movie clip, "movie_mc" with 198 frames.
• movie_mc is controlled by a slider on the main timeline, which allows the user to "scrub through" the movie_mc, but on release of the slider, it SNAPS to 5 specific locations in the movie_mc. I have this code working just fine.
An excerpt of the "snapping" slider code is here:
//drag action on "rotation" slider
sliderbutton_mc.onPress = function() {
sliderbutton_mc.startDrag(false, 338, 619.5, 653, 619.5);
//controlling the movie clip
pos = getProperty("sliderbutton_mc", _x)-337;
frame = Math.round((pos/316)*193);
movie_mc.gotoAndStop(frame);
//snap into place
sliderbutton_mc.onRelease = sliderbutton_mc.onReleaseOutside=function () {
xPos = getProperty("sliderbutton_mc", _x);
if (Number(xPos)<=378) {
setProperty("sliderbutton_mc", _x, 338);
movie_mc.gotoAndStop(1);
} else if (Number(xPos)>377 and Number(xPos)<=456) {
setProperty("sliderbutton_mc", _x, 417);
movie_mc.gotoAndStop(49);
} else if (Number(xPos)>456 and Number(xPos)<=534) {
setProperty("sliderbutton_mc", _x, 495);
movie_mc.gotoAndStop(97);
} else if (Number(xPos)>534 and Number(xPos)<=613) {
setProperty("sliderbutton_mc", _x, 574);
movie_mc.gotoAndStop(145);
} else if (Number(xPos)>613 and Number(xPos)<=653) {
setProperty("sliderbutton_mc", _x, 653);
movie_mc.gotoAndStop(193);
}
sliderbutton_mc.stopDrag();
•i need to create a toggle button that controls specific elements within movie_mc, but CANNOT exist within movie_mc, and MUST be on the _root timeline. (for other complicated reasons).
Here is the tricky part: WITHIN movie_mc: there are labels that appear at 5 specific locations:
**These 5 specific locations have specific (different) text LABELS that appear ONLY at these 5 locations (lets say, frame 1, 49, 97, 145, and 198)
**I am trying to create a toggle button (invis button which controls a 2-frame toggle_mc) to HIDE/SHOW the labels, but as a GROUP (ie, once the user clicks "HIDE", ALL the labels HIDE, regardless of where you are on the scrub/slider until the user clicks "SHOW", where subsequently all the labels will turn on, regardless of where you are on the scrub/slider.
I am having trouble organizing my thoughts, here are 2 failed "methods":
1) WITHIN movie_mc, I have created a Labels_mc movieclip (to be controlled by the toggle btn.). First Method: making Labels_mc on another layer into an equal-length timeline(198 frames, with different labels appearing on the same timeline, only at frames 1, 49, 97, 145, and 198) and have tried to target this (make it visible/not visible) using the toggle button from the _root timeline). Problem: the labels appear as the user is scrubbing the slide button (even though they don't exist in the in-between frames!)
2) I have tried to split up the labels into individual movie clips:
labels1_mc, labels2_mc, labels3_mc, labels4_mc, labels5_mc so that they only appear where they should be, and have attempted using subsequent if/else statements to make them visible, not visible once the toggle button is pressed. This doesn't work once the user scrubs through the movie_mc, because it always defaults to the labels being visible...
3) new train of thought: assigning global variables that can be detected on frame 1 ("HIDE" button) and another global variable that can be detected on frame 2 ("SHOW" button) of the toggle_mc...is this possible, considering how i've organized my file above?? QUESTION: Can you put a global variable on a specific frame of a movieclip, and then can you put a different global variable on the next frame of the same movieclip?
i'm sorry, its a little complicated and I dont know how to best explain myself...any suggestions??? I'm thoroughly a mess...
thank you,
miss_bono
[F8] Toggle A Radio Button OFF
how do i turn off a radiobutton
I run an onPress even that fires each time i click the button even if its selected(where on click only fires if its not already selected)
then i do
if(this.selected){
this.selected = false}
and it turns it off but flash automagically turns it back on
its part of a radiobuttongroup
there must be a way to do this. basically i want the radio to function like a checkbox but only one option or 0 options can be enabled, Im having a tough time getting it to toggle off though
[edit] I just found the setState(false) command and i get the same results it toggles it off but flash immeadiatly toggles it back on.
a RadioGroup.disableAll() type command ?
How Do I Make A Toggle Button
How would I do this?
I want to create a toggle button, so when the button is in it's default position it says "Sound On" and when clicked again it says "Sound Off" etc.
Toggle Button Problem
I can't figure this out :
Here is the code I was recommended on the forum to use a clip as a toggle button to control a clip named SlideShow.
on(press){
if(this._currentFrame == 1){
gotoAndStop(2)
SlideShow.stop();
}else{
gotoAndStop(1)
SlideShow.play();
}
}
The "button" toggles bet. pause and play at frame1 and frame2, but it doesn't stop or play the SlideShow clip.
I'd be grateful for help.
V.
Help With Slideshow And Toggle Button
I've made a menu for a cd using as3. in the menu there is a slideshow that uses xml. I found how to do it on a website and don't really know what I'm doing. Almost everything works as I want. I can't figure out the play/pause toggle button. I've got my different symbols ready to go, a play button, one for when it is pushed, a pause button, and one for when it is pushed. How do I make this happen? Right now the slideshow doesn't play (can't figure that out either). It will go from picture to picture using the left and right arrows but the left (back) arrow doesn't cycle around to the very last picture from the very first picture. Please help it's driving me nuts!!!!!!!!!!!!
Multiple Toggle Button(s)
Hello, I am trying to create a effecient way to create a toggle for multiple buttons and wondering if anyone out there has an effective way to do it. I have about 12 buttons (movieClips) and each has 2 frames in it. "On" and "Off" .. I have it set up right now with a bunch of "_global's" and if Statements in several "onPress" functions .. which works fine, but I am trying to condense all of the code down.
Is there a way I can roll the toggle state and the onPress for each button into just 1 or 2 functions?
Thanks!!
Sound ON/OFF Toggle Button
i have two buttons, on and off.. in my movie.. when the user enters the sound is on, when the user releases off button, i want ALL the sounds in my movie to be turned off..
how do i do this with my previous code. The code i pasted here works for the rollover, rollout, release, just not the sound.. i should mention that i used this code to create my sounds...
var mySound:Sound = new Sound();
//whichSound:String is the linkage name of my sounds from the library)
function playSound(whichSound:String) {
}
//here is an example of a sound that i need to call from the timeline
function transitionSound() {
_level0.playSound();
mySound.attachSound("transition");
mySound.start();
}
heres my on/off code:
function initSoundButton(obj:MovieClip) {
var lastClicked:MovieClip;
var soundArray:Array = new Array();
soundArray.push("onButton");
soundArray.push("offButton");
// Loop through state button array & initialize handlers
for (var i = 0; i < soundArray.length; i++){
var curBtn:MovieClip = obj.soundButton[soundArray[i]];
//trace("current button" + curBtn);
//trace("OBJ sound button " + obj);
// Set default button
if (i == 0) {
curBtn.select = true;
lastClicked = curBtn;
curBtn.gotoAndStop("released");
} else {
curBtn.over = false;
curBtn.select = false;
}
curBtn.onRollOver = function() {
//trace("THIS " + this);
if (this.over) {
this.over = false;
} else {
this.over = true;
}
if (!this.select) {
this.gotoAndPlay("rollOver");
_level0.playSound();
mySound.attachSound("rollOver");
mySound.start();
}
}
curBtn.onRollOut = curBtn.onReleaseOutside = function() {
if (this.over) {
this.over = false;
} else {
this.over = true;
}
if (!this.select) {
this.gotoAndPlay("rollOut");
}
}
curBtn.onRelease = function() {
if (!this.select) {
this.select = true;
this.gotoAndStop("released");
_level0.playSound();
mySound.attachSound("hit");
mySound.start();
lastClicked.gotoAndPlay("rollOut");
lastClicked.select = false;
lastClicked = this;
if (!this == 1) { //this part is not working correctly...
trace("sound are off");
} else {
trace("sounds are on");
}
}
}
}
}
Mute Toggle Button
hey all i have a working audio scrubber and my sound set up a certain way, was wondering how to build/code a mute button that will work with this sound set up. code posted below
ActionScript Code:
this.createEmptyMovieClip("vidsound",2);
vidSound.attachAudio(ns);
var vSound:Sound = new Sound(vidSound);
vSound.setVolume(50);
volScrub._xscale = 50;
volBottom.onPress = function() {
adjustSound();
this.onMouseMove = adjustSound;
}
volBottom.onRelease = volBottom.onReleaseOutside = function () {
delete this.onMouseMove;
}
function adjustSound() {
var dist:Number = Math.floor(((_root._xmouse-volBottom._x)/volBottom._width)*100);
if(dist >= 0 && dist <= 100) {
volScrub._xscale = dist;
vSound.setVolume(dist);
}
}
Music On/off Toggle Button
This should be simple - but its driving me mad!
I am trying to script a music on/off button to control the music playing on a large movie - various different pieces all loaded dynamically with a fadein function.
After the first piece starts in the intro there is a music off button with this script:
Code:
on (release) {
if (done_it != 1) {
back.stop();
done_it = 1
}
}
which basically sets the flag done_it to 1 when the music is off. All other pieces loading check against this flag and will only fadein if done_it != 1.
So far so good.
I also want to add an optional music/on off button which will check against this flag and fadein the music if there is none already playing, or stop all sounds if something is playing.
Thus I have another button later in the movie with this script - and its this that is giving me problems:
Code:
on (release)
{
if (done_it == 1) {
fadeIn01 = 1
if (fadeIn01 == 1) {
// fadeIn01 can be set to 1 when a button is
// pressed, when a frame is reached or many other ways.
_root.beat.setVolume(beatVolume);
// Sets the volume for the sound object "beat"
// to the variable "beatVolume" every time the
// frame is entered during the movie clip loop.
beatVolume = beatVolume+2;
// Increments the variable "beatVolume" by 5.
// Increase or decrease this to change the speed of
// the fade from 0 to 100.
if (beatVolume>25) {
fadeIn01 = 0;
// This stops the "beatVolume" from incrementing
// by making the if-statement false once the volume
// reaches 25%.
}
//Closes 2nd fadeIn if-statement}
}done_it = 0
//Closes 1st fadeIn if-statement}
}
else {if (done_it != 1) {
stopAllSounds();
done_it = 1
}
}
}
//Closes function
This works partially in that it will switch off music already playing or fadein music if none is going. However, I must have goofed somewhere with the music off part as once the music is switched off with this button, it won't then come back on again, yet conversely it works - if the music was already off via the first button in the intro, you can switch it on with this button and a second press will stop it again.
I am guessing that the flag done_it = 1 isnt resetting after the stopAllSounds
but I can't see why or what else I might have done.
Can anyone help?? Please!! Look for the obvious- I'm new at this and there are already many hours work and working thru tutorials to get this far!!!
Fullscreen Toggle Button
Hi,
I am creating a Flash projector file to put on a cd. I wanted to create a Fullscreen Toggle button. But I am not clear on how to set it up. So far i do have what i want, which is, when the projector runs it automatically goes to fullscreen
fscommand("fullscreen","true");
but what i would like to do is create a toggle button, which can switch between fullscreen and non-fullscreen. Can anybody provide me with some assistance on how i can create the toggle button?
Thanks,
Toggle Button W/o Sound
hello again.
i'm trying to create a projector w/ window functionality,
ie. close, max, min
i got the close no problem but now i'm stuck w/ the minimize-maximize button.
anyone have any good resources on how to make a simple toggle button that would suit my needs.
thanks,
Sound Toggle Button Help
i wondered if anyone knows how to do a sound toggle button to play and stop a sound clip
thanks
|