Ugh, so frustrated...
Hi, any help would be appreciated. I'm trying to define a class that will make some textfields appear as if they're a blinking neonsign with a sound clip playing in tandem. I got the code from a tutorial and it doesn't spit out any errors, but it doesn't do anything either. Please help, I'm desperate.
package ActionScript
{
import flash.net.URLRequest
import flash.display.*;
import flash.utils.*;
import flash.events.*;
import flash.filters.*;
import flash.media.*;
public class Flicker extends MovieClip
{
private var timerOne:Timer;
private var timerTwo:Timer;
private var maxFlicker:Number = .85;
private var neonClip:Sound = new Sound();
private var soundControl:SoundChannel = new SoundChannel();
private var NeonOff:MovieClip = new Title_Off();
private var NeonOn:MovieClip = new Title_On();
private var glow:GlowFilter = new GlowFilter(0xFF00FF, 1, 20, 20, 2, 3, false, false);
private var blur:BlurFilter = new BlurFilter(5, 5, 2);
private function timerInit():void
{
NeonOn.alpha = 0;
timerOne = new Timer(2000,0);
timerOne.addEventListener(TimerEvent.TIMER, timerOn);
timerOne.start();
}
private function timerOn(e:TimerEvent):void
{
neonClip.load(new URLRequest("\Audio\neonClip.mp3"));
neonClip.play();
timerOne.stop()
timerOne.removeEventListener(TimerEvent.TIMER, timerOn);
addEventListener(Event.ENTER_FRAME, flickerOn);
}
private function flickerOn(e:Event):void
{
var ultraAlpha:Number = Math.random() * .9;
NeonOn.alpha = ultraAlpha;
if(ultraAlpha>maxFlicker)
{
NeonOn.alpha = 1;
soundControl.stop();
removeEventListener(Event.ENTER_FRAME, flickerOn);
addEventListener(Event.ENTER_FRAME, allFlickerOn);
addtimerTwo();
}
}
private function addtimerTwo():void
{
timerTwo = new Timer(4000, 0);
timerTwo.addEventListener(TimerEvent.TIMER, timerTwoEnd);
timerTwo.start();
}
private function allFlickerOn(e:Event):void
{
var allAlpha:Number = .6 +(Math.random() * .4);
NeonOn.alpha = allAlpha;
}
private function timerTwoEnd(e:TimerEvent):void
{
timerTwo.stop();
removeEventListener(Event.ENTER_FRAME, allFlickerOn);
timerTwo.removeEventListener(TimerEvent.TIMER, timerTwoEnd);
timerInit();
}
}
}
