ActionScript 3.0 :: Disable Play Button When Playing Song
Oct 7, 2009
I have a play button and stop button when I click on the play button the song keeps repeating over and over. How to stop this? This is the code I'm using:
var req:URLRequest = new URLRequest("song.mp3");
var sound:Sound = new Sound();
var controller:SoundChannel;
function soundLoaded(event:Event):void {
controller = sound.play();
[Code] .....
I have a sound clip that I'm loading externally into my flash file. The code I'm using looks like this and is placed in the as layer on the first frame,
var mySound:Sound = new Sound(); var myChannel:SoundChannel = new SoundChannel(); var myTransform = new SoundTransform(); var lastPosition:Number = 0; mySound.load(new URLRequest("introaudio.mp3")); myChannel = mySound.play(); [Code]....
I have a list of mp3-songs, when song 1 is clicked it gets streamed, a stop-button appears, if this Btn is clicked, this Btn disappears as it should - but if user forgets to click for stopping sound and clicks song 2, stopBtn 1 remains and the new stopBtn 2 also appears. there should be only one stopBtn, the one next to the song is playing.
I would like to move the stopBtn and I have tried several approaches move; graphics.moveTo; if(stopButton !=null) {removeChild (stopButton)}; I packed the var stopButton:Sprite in the header and so on.
I have made a combobox and I am trying to make it so that when I press a button, the song that is selected plays. I have this code already but it doesn't work. ActionScript Code: song1 = new Sound(); song1.attachSound("pdandcos"); song2 = new Sound(); song2.attachSound("pieman"); song = song1; play_btn.onRelease = function() { song = songlist_cb.value; song.start(); };
i started with a Multiple mp3 players project and i more complicated with that - as you see in the picture i try to do that when click on the play button for every song this switch the song that selected -first preloading + percentage the mp3 file and after play it immediately and of course there is stop button, pause button when choose a song the previously that play will be muted
I am creating a project and I want the user when they hover over my button to have a song play, when the user leaves the over state, the song stops, I can't seem to get it to work. Here is what I am doing, I have my button, inside the button on the over state I nest a Movie Clip, inside of that I bring in the song, in the properties I set it to "Start" and "Repeat x 0".
When I load the SWF it automatically plays.I've tried adding some AS3 to it but I can't seem to get it to work. like "stop();" which did nothing.I did some googling and found "SoundMixer.stopAll();" which does stop the song from loading on start.
The problem I have is I click the play button and start playing. Then I click next and when I click play for another song the songs overlap. How can I stop whatever song is playing and start playing the new one? Has to stop the prev song when I click play_brn.
2)there are three buttons in my project button 1, button 2, button3 if you press button1 button 3 should get disabled and if your press button 2 then button 3 should get enabled and also an alert should be displayed at the same time that button 3 is disable or enabled
I have an mp3 file that i dragged into a layer, which starts playing at the beginning of my movie.if i preview, i can hear it playing.
annoying problem is that if i stop or pause the preview, the music keeps playing and if i start it again, another instance of the audio track starts playing again so that they are playing at the same time.
I have developed a Player where I am using FMS to play MP3 files, it works great in normal scenario but when user keep on clicking new songs from Song List (List Component) then the player stated playing all songs. Which It should not do. Is there a way that we can unload previous song before loading new song.
For the music player that I've designed and am making come to life in actionscript 2.0, I'd like to have a custom made image be shown for the entirety of the song that it corresponds to. I've already made the images for each of the three songs, but now I just need to figure out how to make them show inside the player every time it's matching song plays. I should add, that I've made a default image for the player as well, that I'd like to be shown, whenever a song is not playing.
Additionally, there is a "Play All Songs" button that is already operational on the player and plays 3 songs in succession. How would I go about adding the 3 images to be shown consecutively, as each song plays? The way the button is set up, I joined all 3 of the songs together with a 3 second space in between, as a single music file. So the button contains only one file that plays all 3 songs, not a separate one for each of the them.
okay.. i'm using a xml n URLrequest to bring up the song n song list in a listbox but, I want the song hold for x seconds (because there r a silent opening first, then I want the the song start when the silent opening ends). Perhaps there r code to add delay just to the song so it not autoplay? Plus I dont know where to put the code..
I downloaded player from [URL].. but I don't know why what the problem it had with with playlist. I had a playlist in xml file with songs. When i deleted the mp3 from the server, it is still playing. and when i changed the mp3 files it is still playing the original files. I don't know where these files were saved. I thought it was saved in my browser cache and i cleared it but it didn't work. I thought it was cached in my server, but in my localserver , i had the same problem.
So, again i downloaded the player, and this time it played different song, that i put. I have a hypothesis. Does flash player (swf object) absorb mp3 files?? i don't think so but how come player is playing the mp3 that has been changed or deleted? if it was in server cache then how long will it take to clear the cache and play new file. However, i don't remember coding something like 'cache'
I'm playing a song and syncing up some visual changes with that song. The issue is that in order for the song to play when I preview my changes to the animation, I have to start playing my flash project from frame 0. This becomes a problem when I am trying to sync to things that occur later in the song. For example, if I'm trying to sync something at frame 300 then I have to re-play the entire animation from frame 0 in order to hear the song at frame 300 and beyond.
Is there any way to get the song to play, starting from the correct position, regardless of where I start running my animation while developing? I could hack something up in action script to move the play head and play the song if it currently isn't being played but I'd rather not go down that route as there must be a simple solution to this problem.
i'm just new to actionscript, how will i trigger an javascript function when i click the button play and also when i finished playing an mp3 file song?
I am importing video into flash via FLVPlayback Component..
What I would like to do is have a button after the video is done playing that offers to re-play the video and may be another button with some other action.. I"m sure it's some kind of "if" statement... (to see when the video is done playing)
I am importing video into flash via FLVPlayback Component.. What I would like to do is have a button after the video is done playing that offers to re-play the video and may be another button with some other action..
I am developing an online listen music website, on that I want to play song based on the user selection from gridview.right now I am using flash object for playing mp3 and video file this is running fine but its static path.how I can dynamically pass file URL of selected song on flash object.
I'm looking for some help regarding stopping sounds in Actionscript 3. Basically I'm making an interactive story game, basically a quiz game. On the main menu I have a narrator talking. What I basically want to do is have the track stop playing when you press the play button. I have the soundtrack playing already and the play button too. I just can't figure out how to get the sound to stop when I press the play button and it goes to the next scene.
Is there an easy way to switch out a movieClip for another dynamically loaded movieClip?
I have and eventListener onCLICK that when selected it starts an FLVPlayback but I would also like to swap out with another movieClip Play Now / Now Playing button.
Just some background. I am looping and loading a play button jpg's into one movie clip and assigning an incremental number as a name to the play button movie clip. On Click that play button plays a movie but now I would also like to switch the play button graphic to a playing now graphic.
//ADD EVENT LISTENER TO ALL MY THUMBS_BUTTON thumbs_button.addEventListener (MouseEvent.CLICK, playVideoThumb); for (var i:Number = 0; i < my_total; i++) {
I have a simple Flash-player button (toggle play/stop) that plays MP3s. When I press play the MP3 starts and the button changes to stop. When I press again the music stops and the stop-button changes to play. I have several player-buttons on my page. How do I stop all sounds when I press play on one of the buttons? As of now, I can start several MP3 at the same time and I don't want that. I've tried this: Code: import flash.media.SoundMixer; SoundMixer.stopAll(); But it doesn't work out. Do I need to number the players somehow?
Also, when the MP3 has finished playing it should turn into a play button. As of right now it's a stop-button when it's finished playing. How do I change it to a play-button? This is the Actionscript 3 code: var flashVars=this.root.loaderInfo.parameters; var loadSnd:URLRequest = new URLRequest(flashVars.myVar); var thisSnd:Sound = new Sound(); var sndTrans: SoundChannel = new SoundChannel(); thisSnd.load(loadSnd); [Code] .....
I'm making music visualization in papervision3d using FlashDevelop. The script generates 150 cubes each acting as different tone (from basses with red colors to high notes with blue).The song starts, everything works fine, but after 44 seconds song stops. I hadn't wrote function that would do that. I've turned off every useless visual functions and even papervision3d rendering. The scene is just black and the song still stops playing after 44 seconds.File is included with:
Code: [Embed(source = "../assets/8bp069-05-she-session.mp3")] because I'm not writing it in flash.
I've tried different song and it stops after 1:10...Flash uses ~30MB of Ram and 50% of my Athlonx2 64 2.6Ghz in action.
Here's some code: sound
Code: [Embed(source = "../assets/8bp069-03-she-pioneer.mp3")] private var Music:Class; private var sp:Sound = new Music();[code].........
those last 3 functions have nothing to do with playback.Am I doing something wrong with computeSpectrum function? Here's the scrieennie of it in action: Of course it's like an alpha version of what I'm planning to do.
I am loading mp3's externally as to not bloat the swf. However, only 1 out of 3 songs play (2nd song plays) for this jukebox I'm having to create for an assignment. I would think if one song played, they all would. I've checked the AS2 code and it all seems right to me; the song names and button instance names. I sure could use some insight as to why the 1st and 3rd song doesn't play. My jukebox is at: [URL] and here is my simple code in the first Actions frame. This is the only code I used for the jukebox.
I have problem with the code below. its a flash mp3 player. I need to prevent it from autoplay from the start. but keeps on playing all the tracks after the user click on play. How can i fix this?
Code: import flash.filters.DropShadowFilter; var infostruc:Array = []; var xmlData:XML = new XML();
I have this text file text.txt and it has a variable in it named song1 with the url of a song file. In flash, I set up this actionscript:
onClipEvent (load) { loadVariables("text.txt", "_root"); var my_sound:Sound = new Sound(); my_sound.loadSound(song1,false); }
the problem is that I get an UNDEFINED message for the variable song1. But, if I put it in for the variable of dynamic text, the text will show up in the exported flash. I suspect it has something to do with where the variable is being exported to.
I'm trying to have JavaScript call a function from my ActionScript.
ActionScript: import flash.external.ExternalInterface; ExternalInterface.addCallback( "playSong", playSong ); function playSong():void { var _sound:Sound = new Sound(); var _request = new URLRequest("music.mp3"); _sound.load(_request); _sound.play(); }