FORUMS: list search recent posts

onSoundComplete getURL

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Julie MacKenzie
onSoundComplete getURL
on Feb 7, 2010 at 5:51:58 pm

I am trying to get an equalizer animation to redirect to a url AFTER the called on MP3 track has finished playing. But I am pulling my hair out in trying to figure out how to do this... I think i need this following action script inserted somewhere into the original action script, but i'm not sure. Please help!!


INSERT THIS ACTION SCRIPT INTO THE ORIGINAL ACTION SCRIPT??:
this.faTrack.onSoundComplete = function() {
getURL("http://www.google.com", "_self"); }



ORIGINAL ACTION SCRIPT:
onClipEvent (load) {
//----------------------------------------------------
//This is the only line of code you probably need to change.
//Type in the name of the txt file output by FlashAmp.

#include "collage.txt"


//----------------------------------------------------

//hides the controller.
_visible = false;
//sets up a sound object, loads the .mp3 file and starts the sound.
this.faTrack = new Sound();
//use attachSound if the sound is in the library and linked.
//use loadSound if the sound is an external .mp3.
//ie comment out one of the next 2 lines.
//this.faTrack.attachSound(faFile);
this.faTrack.loadSound(faFile, true);
this.faTrack.start();
//following is a list of variables you can use from the include file.
//trace(faFile);
//trace(fps);
//trace(scale);
//trace(stereo);
//trace(numBands);
//trace(lowLimit);
//trace(highLimit);
//trace(bands);
//trace(spectrum);
//trace(spectrumLeft);
//trace(spectrumRight);
}

onClipEvent (enterFrame) {
//works out where the sound is up to in terms of frames.
gFrame = Math.floor((this.faTrack.position/3000)*fps);
//vol = the fraction of volume to adjust the spectrum values.
vol = this.faTrack.getVolume() / 100;

//sets the variables at the root level for every band.
for(i=0; i < numBands; i++) {
if(stereo == 1){
//if stereo sets _root.gAmpLeft0, _root.gAmpLeft1, _root.gAmpRight0, _root.gAmpRight1 etc
set("_root.gAmpLeft" + i, spectrumLeft[gFrame][i] * vol );
set("_root.gAmpRight" + i, spectrumRight[gFrame][i] * vol );
}else{
//if mono sets _root.gAmp0, _root.gAmp1, _root.gAmp2, _root.gAmp3 etc
set("_root.gAmp" + i, spectrum[gFrame][i] * vol);
}
}
}


Return to posts index

demetri tashie
Re: onSoundComplete getURL
on Feb 8, 2010 at 11:56:28 pm

sorry, i don't work in AS2 -
here is a recent discussion that included that very SOUND_COMPLETE event listener which s attaches to a SoundChannel.

have a look and see if this helps. it is, of course , talking about AS3 code, but maybe you can adapt it to AS2....

http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=28518&sid=a506c5b1372...


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]