?
Solved

What is different in actionscript 3 with regard to the stop() action?

Posted on 2008-10-31
2
Medium Priority
?
1,016 Views
Last Modified: 2013-11-11
Greetings Experts,

I am having difficulty preventing Flash scenes from looping in AS3.  I have a very simple test file with two scenes (Scene 1 and Scene 2).  I have a button in Scene 1 that when clicked, loads Scene 2.  This works correctly in AS2 but in AS3 the two scenes just continuously loop.  AS3 seems to be ignoring my stop() action (or I am doing something wrong).

Scene 1 frame 1 actions:
btnSubmit.onRelease = function() {
     gotoAndPlay("Scene 2", 1);
}

Scene 1 frame 2 actions:
stop();

Scene 2 frame 1 actions:
stop();

Can someone please help me understand what I'm doing wrong?  Please elaborate on the "why" behind your solution.

Thanks!
0
Comment
Question by:bham3dman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
jordanaustin earned 2000 total points
ID: 22859423
bham3dman,
I'd venture to say that it's not the way the stop action is effecting this, its the way you've scripted your button ActionScript. That would work correctly in AS2 but for AS3 you'll need to open an event listener.

Try using this code:

btnSubmit.addEventListener(MouseEvent.CLICK,btnSubmit_CLICK);

function btnSubmit_CLICK (e:MouseEvent):void
{
btnSubmit.gotoAndPlay"Scene 2", 1);
}
stop();

Let me know if that works.

-jordan
0
 
LVL 5

Author Comment

by:bham3dman
ID: 22863086
Thanks for the response Jordan.  Your solution pointed me in the right direction.  However, I did have to modify your code in order for it to work.

The following code worked:

btnSubmit.addEventListener(MouseEvent.CLICK, btnSubmit_CLICK);

function btnSubmit_CLICK (event:MouseEvent):void
{
gotoAndPlay(1, "Scene 2");
}

stop();

Thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question