Copy link to clipboard
Copied
I posted a file earlier today (upgrading from AS2 to A S3), which was solved.
I am trying to reuse the code by attaching a button the allows the viewer to move to the nextFrame and experience the Writing Effect but with new copy.
It works but I keep getting the dreaded #1006 error. I keep commenting out parts but nothing changes. When I DEBUG it seems to reference
frame 2 line 36 which is related to the sound.
TypeError: Error #1006: stop is not a function.
at Write_AS3_fla::MainTimeline/onTimerB()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
I appreciate the help.
This is the code, which has been modified by placing "A" or "B" to alter it.
stop();
var strA:String = " Hello There";
var timerA:Timer = new Timer(1);
timerA.addEventListener(TimerEvent.TIMER, onTimerB);
timerA.start();
var countA:Number = 0;
//creating an instance for sound
var sA:type = new type();
var schannelA:SoundChannel;
function onTimerB(event:TimerEvent):void {
if(count == 0) {
schannelA = sA.play(0,1000);
}
theText.text = strA.substring(0,count);
count += 2;
if(count > strA.length) {
timerA.removeEventListener(TimerEvent.TIMER, onTimerB);
schannelA = sA.stop();
}
}
The solution hasn't changed... The Sound class does not have a stop() method. The SoundChannel class does, which is why you assign the play() method to a SoundChannel object variable (play() returns a SoundChannel object)...
var strA:String = " Hello There";
var timerA:Timer = new Timer(1);
timerA.addEventListener(TimerEvent.TIMER, onTimerB);
timerA.start();
var countA:Number = 0;
//creating an instance for sound
var sA:type = new type();
var schannelA:SoundChannel;
function onTimerB(event:TimerEvent):v
Copy link to clipboard
Copied
The solution hasn't changed... The Sound class does not have a stop() method. The SoundChannel class does, which is why you assign the play() method to a SoundChannel object variable (play() returns a SoundChannel object)...
var strA:String = " Hello There";
var timerA:Timer = new Timer(1);
timerA.addEventListener(TimerEvent.TIMER, onTimerB);
timerA.start();
var countA:Number = 0;
//creating an instance for sound
var sA:type = new type();
var schannelA:SoundChannel;
function onTimerB(event:TimerEvent):void {
if(count == 0) {
schannelA = sA.play(0,1000);
}
theText.text = strA.substring(0,count);
count += 2;
if(count > strA.length) {
timerA.removeEventListener(TimerEvent.TIMER, onTimerB);
schannelA.stop();
}
}
Copy link to clipboard
Copied
I finall had a chance to get back to this project. Thanks, that was it. For some reason I did not see that mistake until it's pointed out.
However, once I ran it I got the #1009 error. After commenting out each line I still found that things were off. The sound went crazy or there was no type.
I focused on the - var countA:Number = 0; The first section of code was - var count:Number=0;
I changed the word entirely to - var once:Number = 0;
Now everything works great No Errors.
So What's up with that. Is AS3 that sensitive to naming.
Once again Thanks
Copy link to clipboard
Copied
Your welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now