Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-11-2007, 04:38 PM   #1
k_os
Senior Member
 
Join Date: May 2003
Posts: 204
Send a message via ICQ to k_os Send a message via AIM to k_os Send a message via MSN to k_os Send a message via Yahoo to k_os
Default making a music loop

ActionScript Code:
// music setup var snd_music:Sound = new Sound(); snd_music.load( new URLRequest( "media/music.mp3" ) ); var sc_music:SoundChannel = snd_music.play(); sc_music.addEventListener( Event.SOUND_COMPLETE, onSoundComplete_music, false, 0, true ); //---------------------------------------------------------------------------------------------------------- function onSoundComplete_music( event:Event ):void {     trace( "onSoundComplete_music()------------" );     trace( "  event: " + event );     snd_music.play(); }

this works but only plays the music twice. if i tried this function:

ActionScript Code:
//---------------------------------------------------------------------------------------------------------- function onSoundComplete_music( event:Event ):void {     trace( "onSoundComplete_music()------------" );     trace( "  event: " + event );     event.target = snd_music.play(); }

it says something about event.target being read only.

how do i make a music track infinitely loop?
k_os is offline   Reply With Quote
Old 10-11-2007, 06:44 PM   #2
k_os
Senior Member
 
Join Date: May 2003
Posts: 204
Send a message via ICQ to k_os Send a message via AIM to k_os Send a message via MSN to k_os Send a message via Yahoo to k_os
Default

so i did this:
ActionScript Code:
//---------------------------------------------------------------------------------------------------------- function onSoundComplete_music( event:Event ):void {     trace( "onSoundComplete_music()------------" ); //  trace( "  event: " + event ); //  trace( "  target: " + event.target );         sc_music = snd_music.play();     sc_music.addEventListener( Event.SOUND_COMPLETE, onSoundComplete_music, false, 0, true ); }

and it loops, but isn't this creating like a big infinite recursion loop? what if i wanted to setup mutliple channels and loop each, but only wanted one function to do it? seems kinda weird, that I can't do that.

i've searched google for an hour trying to find the answer to this and no one seems to have it. seems kinda weird that nobody's tried to loop a sound until now.
k_os is offline   Reply With Quote
Old 10-17-2007, 11:17 PM   #3
jubishop
Registered User
 
Join Date: Jul 2007
Posts: 5
Default Infinite looping

try this:

//----------------------------------------------------------------------------------------------------------
function onSoundComplete_music( event:Event ):void
{
trace( "onSoundComplete_music()------------" );
// trace( " event: " + event );
// trace( " target: " + event.target );

sc_music = Sound(event.target).play();
sc_music.addEventListener( Event.SOUND_COMPLETE, onSoundComplete_music, false, 0, true );
}
jubishop is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Music Loops provider Beatsuite.com wins eCommerce awards thebeatsuite General Chat 10 01-12-2006 02:19 PM
fading in music for first loop Jerico ActionScript 2.0 0 10-04-2005 06:53 PM
Making a Movie wait 30 seconds and loop stephanieharte ActionScript 2.0 2 09-22-2005 06:48 PM
Music Loop mel2000in ActionScript 1.0 (and below) 2 04-06-2005 01:41 PM
Looping making me loopy drliebs ActionScript 1.0 (and below) 1 08-19-2003 10:06 AM


All times are GMT. The time now is 11:31 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.