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

Play/Pause Toggle button...

Community Beginner ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Hi,

I'm trying to make a play/pause toggle button...

I created a play button and a pause button and have them sitting on different layers. Here's the code I was trying to use:

playBtn.onRelease = function() {
ns.pause(false);
playBtn._visible = false;
pauseBtn._visible = true;
};

pauseBtn.onRelease = function() {
ns.pause(true);
playBtn._visible = true;
pauseBtn._visible = false;
};

But I'm getting this error: "access of undefined property ns"

What gives?

Thanks in advance for any advice!

~Julia

TOPICS
ActionScript

Views

2.6K

Translate

Translate

Report

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 ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Have you created a NetStream object with the instance name "ns"?  Have you set your Publish Settings for Actionscript 2?  id you realize you posted in the wrong forum for the version of actionscript you are using?

Votes

Translate

Translate

Report

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
Community Beginner ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

hmmm... i was afraid it was as2. GRRRR

I need an as3 eqiv, I guess.

Votes

Translate

Translate

Report

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
Community Beginner ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

Dumped that code and switched to this:

pauseBtn.addEventListener(MouseEvent.CLICK, stopMovie);

function stopMovie (Event)
{
    stop();
}

playBtn.addEventListener(MouseEvent.CLICK, playMovie);

function playMovie (Event)
{
    play();
}

Now I just need to add show/hide...

Votes

Translate

Translate

Report

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
Community Beginner ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

got it...

playBtn.addEventListener(MouseEvent.CLICK, playMovie);

function playMovie (Event)
{
play();
playBtn.visible =false;
pauseBtn.visible =true;
}

pauseBtn.addEventListener(MouseEvent.CLICK, stopMovie);

function stopMovie (Event)
{
stop();
pauseBtn.visible =false;
playBtn.visible =true;

}

Hopefully this thread will help some other as3 newbie-dufus, (like myself!!!)

Votes

Translate

Translate

Report

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
Community Beginner ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

LATEST

Just need a bit of code to pause the .wav along with the visuals...

Ned?

Votes

Translate

Translate

Report

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