ActionScript 3.0 :: Get A Button To Toggle Playing Or Stopping A Mp3 If Click It Or Hit The Space Bar?

Feb 26, 2010

I'm trying to get a button to toggle playing or stopping an mp3 if I click it or hit the space bar. The code I have does that but it does something funny I don't understand. This is the code:

var s:Sound = new Sound(new URLRequest("song.mp3"));
var sc:SoundChannel;
var playtggl:int = 1;

[code]....

As you can see I've added two event listeners on the button, one for the mouse and for the spacebar. Thing is everytime I hit the spacebar, my function for the mouse click fires up. I don't understand how this is happening.Also, how do you have the event listener listen for a spacebar event without having to first focus on the button by clicking it with the mouse?

View 2 Replies


Similar Posts:


Professional :: Stopping Sound Playing On Button Click?

May 3, 2010

I found this code to play sound:

myButton_btn.addEventListener(MouseEvent.CLICK, buttonIsClicked); [code]....

I got it working fine, but was wondering how to program a function for another button to stop stop playing that sound?I tried a function with snd.stop(); but that seems to be incorrect.

View 6 Replies

ActionScript 3.0 :: Toggle Button Revisited - Get It To Stop Playing When Clicked On Again

Jan 10, 2010

I redid my toggle button. I have music playing when its clicked down, I just cant get it to stop playing when clicked on again.

[Code]...

View 2 Replies

ActionScript 1/2 :: Toggle A Boolean When Click Button

May 4, 2009

I would like to toggle my boolean value when I click my button. My boolean var looks like this: var playAllOn:Boolean = false; Then I have a button that calls a function to set the playAllOn to the boolean value it currently is not. So, if for example if playAllOn is false, I would like to call:

[Code]....

I know I could do this with an ifStatement in the myToggleBtn.onRelease, but am wondering if there is a better more efficient way to write this. Something like setPlayAllBtn(!= playAllOn); <!-- Obviously that one does not work...

View 3 Replies

ActionScript 3.0 :: Conditional Click States - Toggle Button?

Jun 25, 2009

I have a button hit state called btnWorkH, below is the start of my code to make it functional. The idea being, that when someone clicks the button, I add a child to the top, to make it look like it has been clicked and is maintaining an alternate color. How would I code this so that it becomes a toggle? As, I need a click (once this action has been performed) that removes the child... just not sure how to write the condition for this.

btnWorkH.addEventListener (MouseEvent.CLICK, workClick);
function workClick (e:MouseEvent):void{
addChild (workO);
workO.x = 62.5;
workO.y = 109.3;
addChild (txtAmy);
txtAmy.x = 105.1;
txtAmy.y = 109.3;
}

View 7 Replies

ActionScript 3 :: Toggle Button - Hide / Visible On Click

Nov 6, 2010

I have a script that once clicked ( a button ) some other thing hides then once clicked again it re-shows. the problem is once hidden it never shows again here is the script:

menu_start.addEventListener(MouseEvent.CLICK, myClickFunction);
function myClickFunction(event:MouseEvent) {
// Hide the first and show the next here
if (menu_menu.visible == true){
menu_menu.visible = false;
} if (menu_menu.visible == false) {
menu_menu.visible == true;
}}

View 3 Replies

Actionscript 2.0 :: Developing A Flv (streaming) Player - Add 'full Screen' Option (on-click Of A Button...say A Toggle One) To It?

May 5, 2009

I'm developing a flv (streaming) player and I want to add 'full screen' option (on-click of a button...say a toggle one) to it.

I've added <param name="allowFullScreen" value="true" />and it's working fine on my local machine but not on web.

View 3 Replies

ActionScript 2.0 :: Space Bar Visibility Toggle Control

Aug 19, 2009

I found an earlier post with the following solution for mouseover visibility control.
ActionScript Code:
instancename.onRollOver = function() {
this._alpha = 0;
} instancename.onRollOut = function() {
this._alpha = 100;
}
What changes would I make to use the space bar as a toggle for visibility? Or would I need something completely different?

View 3 Replies

ActionScript 3.0 :: Multiple Button Functions - When Click The Button, The Mc Does Not Stop Playing And The Text Does Not Show Up?

Nov 8, 2009

I'm designing an interface for a class, and the buttons that I am using all have multiple functions.For example, when the story button is clicked, I need the mc to stop playing and change to text (in the same window/screen, just no mc playing).  The mc is 31 frames long, but if there's a way to just make it loop continuously until told not to, Currently, my code looks like this:

stop();
story_btn.addEventListener(MouseEvent.CLICK,story);
function story(event:MouseEvent):void { gotoAndStop(32);}credits_btn.addEventListener(MouseEvent.CLICK,credits);[code]...

When I click the button, the mc does not stop playing and the text does not show up. 

View 6 Replies

ActionScript 3.0 :: Automatically Loading One Swf Once The Other Is Done Playing Without A Button Click?

Nov 7, 2009

I really just need help automatically loading one swf once the other is done playing without a button click.a.swf has several buttons. When a button is clicked an animation plays within a.swf. If button b is pressed, once it's animation plays in a.swf, I need it to automatically jump to b.swf.I have no idea where to go.

View 0 Replies

ActionScript 1/2 :: Make Sanpshot From Playing Video Through Button Click?

Oct 11, 2011

How to make sanpshot from playing video through button click? (to local machine)
 
 

View 1 Replies

ActionScript 3.0 :: When Click The Next Button The Current Track Keeps Playing While The Next One Starts

Apr 9, 2009

I'm making a mp3 player using flash. when i test the movie it starts playing fine but when i click the next button the current track keeps playing while the next one starts. plus the stop button it's not working. here is the code.

[Code]...

View 1 Replies

ActionScript 1/2 :: Click Invisible Button On Moving Target For Playing Movie

Dec 30, 2009

I have an image of a target on stage, that moves left and right. In the center of the image is an invisible button, occupying the centre circle of the target. The idea is you click the invisible button on the moving target and this starts another movie playing. Seems to me the action script should reside in the button, and be something like this:

on(release){
targetPath(this.movie2);
play();
}

View 2 Replies

Swf In Flv Not Stopping, Video Keeps Playing?

Jun 4, 2010

I'm making a basic flash website, and have already created the site structure, but I'm having trouble adding FLV and SWF, as they aren't responding as I would like.

1) I have built a basic flash photo gallery, and it works great. I have exported the SWF, but when I add that to my main sites keyframe, it plays non stop, and the buttons on that embedded SWF don't work.

2) After adding a FLV video to a keyframe, it works as I would like. Except that when I click to another keyframe after starting the video, it keeps playing. How would I be able to pause/stop the video if a navigation button to other keyframes are clicked.

View 1 Replies

ActionScript 3.0 :: Connecting Files ... When Click Down Onto The Toggle The Music And Timer Both Run At Once?

Mar 9, 2011

I have a game with a timer and toggle button that plays music. The AS3 file that runs the timer is the main doc clas(as3 file) and the timer is a custom event as3 file I made, is there a way I can link the 2 so that when I click down onto the toggle the music and timer both run at once.

View 1 Replies

Stopping A Flv Using A Conditional Statement If The FLV Is Playing?

May 25, 2009

How would you stop an FLV using a conditional statement where the condition is if the FLV is playing?

I'm using AS 3.0. My best shot was this:
 
if (demo.flv == play){ demo.flv.stop();  }
 
I'm sure the "== play" part is wrong, but I cannot find the correct code that checks to see if the video is currently playing.
 
My flv component does have an instance name of "demo". The command "demo.flv.stop(); works fine as a non-conditional, but the flv is not always playing with my navigation set-up when you land on the frame with the code, so I need a conditional.

View 3 Replies

Professional :: Playing An Animation Then Stopping?

Jun 9, 2010

i have a graphic that basically is set to pivot onto the screen using a motion tween. my problem is once the animation plays the graphic disappears whereas i would like it to remain on screen and displaying its last frame

View 2 Replies

ActionScript 2.0 :: Playing And Stopping Movieclips?

Nov 3, 2004

I created 3 movieclips each are loaded externally.

videoHolder1.loadMovie(movie1.swf);
videoHolder2.loadMovie(movie2.swf);
videoHolder3.loadMovie(movie3.swf);

[code]........

View 2 Replies

ActionScript 2.0 :: Stopping A Currently Playing Sound?

Jun 14, 2007

I am making a kiosk based on another designers layout where I work... I am not going to get in the details, but the work seems sort of an unorthadox way of using flash - anyways...

It is basically an interactive slide show... play, pause, previous slide, next slide...

Each SWF that is loaded in is around 15000 frames in lenght (right under that magical 16000 number) - the audio voice overs are on the time line one after another... so when the slide changes the voice over matches the slide current slide... there are 31 slide JPGs and 31 mp3 files that are divided between 8 SWFs.

The issue I am having is that when you are one the first "SWF" (slides 1-5)... and you move from slide 1 to 2 before the audio is done playing... it will keep playing the audio from slide one and then start the audio from slide to ... so on and so forth until you get to slide 6 - which is a new SWF that is loaded...

I know that I need to use a stop sound script somehow... on the first frame of each of the following slides so that it stops the currently playing sound... if it hasn't already finished...

if you let the presentation go it works fine... but when you move forward and back... the sound gets garbled....

View 8 Replies

ActionScript 3.0 :: Playing One Sound While Stopping The Others?

Feb 26, 2009

I'm stuck while trying to playing some sound and stopping the others. What I do is : I'm using a linkage to get access to my sound. For example I have 5 linkage sound. I need to play just one specific sound and stop the others. I create a new Sound() and a new SoundChannel() for each one , and put it all in Array. But when I'm trying to stop the others by stopping it's channel, it won't work: The snippet is somewhat like this :

Code:
for(i=0;i<song_.length;i++)
{
if(snd==song_[i].clas)

[Code]....

I have an array of object that have a sound and channel for each one.

View 1 Replies

ActionScript 3.0 :: Playing And Stopping Sound?

Sep 13, 2010

I had been through your post which telss about playing sound using AS3. It was really helpfull. I just wanted to know how we can stop the sound using a Button click event.

View 1 Replies

Stopping Flash Playing When It Loads Open

Jul 16, 2010

I have a simple html splash page which when clicked goes to another html page with my flash object in it. When I click the first page the flash runs the whole animation and loops it continuosly. Id like it to just stop at fram 0 when it loads!

View 2 Replies

ActionScript 3.0 :: Stopping An FLV From Playing After Clicking To Another Scene?

Aug 8, 2009

I am a High school teacher working on a students work in CS4 flash Actionscript 3 and we are trying to stop the flv from playing when you click on the navigate to scene button. I can get the flv to stop but it is displaying in the background of the next scene.here is the code that i am using

import fl.video.*;
var myVideo:FLVPlayback = new FLVPlayback();
myVideo.source = "1LEO_1 00-31-54.flv";

[code]......

View 3 Replies

ActionScript 3.0 :: Stopping And Playing Some Movie Clips?

Mar 17, 2011

I have a problem with some AS3 code and i don't understand why.. my code looks like this:stop();

[Code]....

But there shouldn't be a problem with this, cause the movieclips are the same as the others and has an instance name of gt5 and gt6 just like the other movie clips, and the code is obviously the same?

View 11 Replies

ActionScript 3.0 :: Playing Sound And Stopping When Swf Is Added?

Sep 7, 2010

So I have a main swf and when the user clicks on certain buttons, an external swf is added to the stage, which is an mp3 player.There is a sound playing in the main swf that I want to pause when that swf has been added to the stage and then resume when it is removed.How would I accomplish that? I assumed I would put a conditional statement that if the loaded swf's current frame was less than 16 (16 is when it closes), to pause the sound and if it was larger than 16 to resume the sound at its current position. But this isnt working.

ActionScript Code:
var soundClip:Sound=new Sound();
var sndChannel:SoundChannel=new SoundChannel();

[code]....

View 0 Replies

ActionScript 3.0 :: Stopping A Loded Movie From Playing

Mar 9, 2009

I am trying to load a swf file by using a loader.the loader is set to visible = false; until 50% of the swf is loded and once that is done I am setting the visiblity to true.But the only problem is the loaded swf starts playing automatically and when after loading 50% I set the visibilty to true then half of the movie has already player.How can I stop a loaded swf from playing atuomatically.?

View 1 Replies

IDE :: Loop To Keep Playing Regardless Of The Timeline Stopping And Starting

Apr 29, 2009

i just want my loop to keep playing regardless of the timeline stopping and starting. is this possible?

View 1 Replies

ActionScript 2.0 :: FLASH 8 - Toggle Button/released State/pressed Button

May 18, 2007

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?

View 1 Replies

ActionScript 3.0 :: Simply Stopping Movie From Playing On Frame

Apr 1, 2010

I am trying to simply stop the movie from playing on a frame, the way we used to do with stop(). Every tutorial source I have looked at is a blur of words like stop and movie being used in too many ways. I'm not stopping an external flv. I'm not stopping an external or embedded swf. I just want to stop the movie that this frame is a part of until the user chooses to advance to the next frame.

View 1 Replies

Professional :: Playing - Pausing - Stopping Audio In A Timeline

Feb 23, 2010

I don't use Flash that much so the question may sound simple, but how do I pause audio in a timeline? I have added the audio, play and stop button. When I test it works fine, but I can't figure out how to add the pause button, or the play/pause button.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved