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.
does anybody maybe know how to track/trace the current position of a sound file while it is playing?So that it is updated every frame or second?I figured something with trace(sound.position) onEnterFrame, but didn't succeed in realizing this yet.
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.
I have four movie clips (.f4v) in 4 frames in a movie with watch buttons.. This movie has them been imported into a main movie container that has next and previous buttons. However if i play a movie then hit next frame, the movie continues to play in the background. The code below shows one of the actionscripts for a movie clip and then the main actionscript in the main movie.[code]...
I have this menu that I am loading my swf files under a as. file and linked to a xml file. It loads perfectly my swf files when i click on the buttons, but when i keep clicking the buttons, it keeps loading it on top of each other...How can i unload the current swf file when i click on the other button.? under the as file i have the following to load my swf files:
private function customFunc(link):void { var request:URLRequest = new URLRequest(link); var loader:Loader = new Loader() loader.load(request) var swfContainer:MovieClip=new MovieClip ; this.addChild(swfContainer) swfContainer.addChild(loader);; trace(link); }
I can't believe how impossible it has been to find info about this. I'm sort of a beginner with actionscript, but this shouldn't be as hard as I'm finding it to be.
I'm using AS2. I have an ordinary FLV video playing with one of the skins that comes with the Flash software (CS3). That all works perfectly fine. What I need to do, however, is add a large "PLAY" button over top of the movie. I have made that work also. But, I need the button to disappear when the movie starts playing, because it is obviously in the way and making it hard to view the video.
Some forums suggested making that button disappear when it is clicked. That would be fine, except that the video player skin also has a play button, and if someone clicks that button instead of my new large button, I still need the large button to disappear.
So what I'm trying to figure out how to do is something like: if the FLV is playing, make this object (the button) disappear or become invisible. This can't be that difficult!
Take a look at this site. [URL] You notice when you click on a button the current 'site' you are on dissapears befor the next one loads. How is this done? It's like the code tells flash first to 'close' the current page and then load the page you clicked on.
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.
I am just toying around making an mp3 player and came to a problem. I've got everything to work just fine... but I don't know how to get the player to recognize that the current track is finished and get it to get the next track... how can this be done?
I am creating a game that has 6 movieclips all on the main time line of the game. Each movie clip has three buttons that when clicked plays, pauses or stops a sound clip.When I press any of the sound clip play buttons that sound starts playing, the problem is when I click any of the other sound clip play buttons those sounds also start to play. Is there a way I can disable the other sound clip buttons while the current sound is playing then enable all of the buttons when the current sound has stopped.
This is the code that creates one of the sound objects
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.
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.
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?
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:
I'm building a website & I'm using External Swf's, Everything works fine, but on some pages, e.g "Videos" loads fine, but when I try to click a button into another SWF, it reloads the current SWF "videos" again,, is it something in the preloader script or something,
I'm using the following script to load external swf's in to a main swf, but when I simulate download, the sound of the external swf starts playing before it is completely loaded, i.e, when the percentage in the bandwidth profiler reaches about 60% the sound of the swf being loaded can be heard, and when the percent reaches 100, it continues playing and the content of the external swf are now visible.
var myLoader1:Loader = new Loader(); addChild(myLoader1); var myRequest1:URLRequest = new URLRequest("myMovie.swf"); myLoader1.load(myRequest1);
I have produced an app for iOS but when it loads the music from the iPhone doesn't stop.
I have read on forums that if an app contains sounds that the iPod will fade out but it doesn't for me. I have tried loading the sounds dynamically (these sounds don't play at all if the iPod is playing) and embedding them into the movie. Nothing seems to work sadly. I have ensured that I have all the recent updates for flash and the air packager and I can't find a solution to this anywhere.
On my main SWF Home File i have 2 swf files are loaded into my (main home swf) and everything is runing smooth BUT the problem is when i want to watch the video the music is still playing i have to click on the button to stop music playing.
what i want is when i click on the video to play i want automatically the music to stop playing with out me clicking the mp3 button to stop the music playing.
NOTEKeep in mind i have 2 SWF files that are loaded in to the main swf file ...Home SWF is the main file
MP3 SWF << Loads on Home SWF Video SWF << Loads on Home SWF
All i want is when the video is playing automatically stop the music and when the video is finish the music automatically continuing from where it was left.
I am trying to hide a preview that I inserted with some AS3. The preview works and I use this code to create it.
var preview:Loader = new Loader ();loadPreview (preview, "gotgame.png"); addChild(movie_flv); function loadPreview (loader:Loader, previewFile:String) :void {var u:URLRequest = new
i am loading some external swfs with the bulkloader. The strange thing, they start playing in the background ( i can hear the sound) without even having added them to the stage.
Here is my code:
ActionScript Code: public function init():void { bLoader = new BulkLoader("bLoader");
I'm using the same code I always use for preloading another swf but it's not working this time. The problem this time is that when the loading bar gets to 16% every time you can hear the movie I'm loading playing in the background. I can just add a stop to the first frame of the movie I'm loading ("trial_1.swf") but how do I tell it to go to the second frame once it has loaded?
Here's my code:
var myrequest:URLRequest=new URLRequest ("trial_1.swf"); var myloader:Loader = new Loader(); myloader.load(myrequest);
I'm working on an mp3 player. I want to trigger an event when the track finishes playing. I've created a function that will just trace a statement so that I know the event listener is working, but I can't seem to get it to trigger. Here is the playSong function in which the code is used:
Code: function playSong(mySong:Number):void { var myURL = my_songs[mySong].@URL; playingTra = mySong; current_song = mySong; my_sound = new Sound(); [Code] .....
I tried to add in the following lines, but that instead institutes some playback issues: Code: if (my_channel){ my_channel.stop(); my_channel.removeEventListener(Event.SOUND_COMPLETE, stuff); }
Basically my code at the beginning of the movie queries the server for the file names of jpeg files that are to be loaded into sequential frames. The reason is that the user can enter file names into a database and the application plays them back without the user having to do any flash programming. Currently, my code is using a preloader in each frame along with some additional code to center the picture etc.
This is fine *but* I need all of the jpegs to load before the movie starts, not when the play head gets to each frame. I can't have any delay from one frame to the next. Delay in the beginning of the movie is ok. Can anyone help me with a method to dynamically load these jpegs completely before the movie starts playing?...once loaded they must be available for any frame to call immediately.
I have multiple audio tracks that have a play/stop button functionality. I need to add a script on the buttons that stops a track from playing when another track has been selected.[code]...
So i have this bit of code that triggers a bunch of stuff on a buttons over/out/down etc... I also have a variable on the _root time line that declares a clicked variable so i can keep track of the buttons click state. Ok so now the trouble... Im changing my (working) buttons to movieclip buttons to take advantage of the MC properties (ie. goToPlay - etc.. ). But this screws up my working AS and im not sure why? In particular the "if" statement that keeps track of the clicked variable does not seem to be functioning. Is there a problem putting if statement on a MC button? How do i fix this? Here is the code i'm using on my MC button: