Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

trying to solve #Error 1006

Guest
Apr 25, 2010 Apr 25, 2010

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();

    }
   
}

TOPICS
ActionScript
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 25, 2010 Apr 25, 2010

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

...
Translate
LEGEND ,
Apr 25, 2010 Apr 25, 2010

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();

    }
   
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 26, 2010 Apr 26, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2010 Apr 26, 2010
LATEST

Your welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines