To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Actionscript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-18-2008, 07:35 AM   #1
flash chap
Member
 
Join Date: Oct 2001
Location: Southampton, England
Posts: 83
AS3 stop(); code not working??

Hi all,

Real simple but cant figure it out.
Just trying out flash cs3 and I cant seem to get the main timeline to stop looping as the stop(); command will not work at all.

Does anyone know how to stop the timeline in CS3...its driving me potty.

Many thanks

Jay
flash chap is offline   Reply With Quote
Old 03-18-2008, 09:36 AM   #2
fx.barrett
trace("AKA: Biro Barna");
 
Join Date: Oct 2007
Location: RO.Timişoara
Posts: 1,403
Well, stop() didn't change in CS3, nor did it in AS 3.0 ; it should stop.
Maybe post your .fla or something, it should work...
__________________



| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
|
Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
| By perseverance the snail reached the ark. |

fx.barrett is offline   Reply With Quote
Old 03-18-2008, 09:42 AM   #3
flash chap
Member
 
Join Date: Oct 2001
Location: Southampton, England
Posts: 83
thanks for the reply I will have to re check what the hell Im doing wrong.

Thanks for confirming anyway.
Jay
flash chap is offline   Reply With Quote
Old 03-18-2008, 02:26 PM   #4
cresquin
http://pat.theorigin.net
 
cresquin's Avatar
 
Join Date: Jun 2003
Location: Los Angeles, CA
Posts: 685
if there are any other errors on the timeline, the compiler may ignore your stop();
cresquin is offline   Reply With Quote
Old 03-18-2008, 03:42 PM   #5
fx.barrett
trace("AKA: Biro Barna");
 
Join Date: Oct 2007
Location: RO.Timişoara
Posts: 1,403
As far as I'm concerned the movie won't even compile if he has errors in his code.
__________________



| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
|
Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
| By perseverance the snail reached the ark. |

fx.barrett is offline   Reply With Quote
Old 08-12-2008, 05:26 PM   #6
wessidemd
Junior Member
 
Join Date: Aug 2008
Posts: 5
Check to make sure that you didn't set that layer to invisible. Your code will NOT run if the layer is invisible.

Stupid, yes.
Useless, yes.
Annoying, yes.

Why does the visibility of the layer even matter? I don't know....
wessidemd is offline   Reply With Quote
Old 09-04-2008, 05:37 PM   #7
robh2255
Junior Member
 
Join Date: Sep 2008
Posts: 16
I'm having the same problem with stop(). Stop() won't work in frame 1 (or any other frame for that matter) on the main timeline. Keep in mind that this only occurs when I'm playing my movie within Flash (Control Menu > Play). If I choose the Test Movie option, it works. But I should be able to play this within Flash too. Furthermore, I copied the same code into a new AS2 file and it works fine. So something is wrong with AS3 or it requires additional code. I have nothing else in my file besides stop() so it's not conflicting with anything. The layer is visible too. Any ideas? Thanks!
robh2255 is offline   Reply With Quote
Old 09-04-2008, 09:18 PM   #8
wessidemd
Junior Member
 
Join Date: Aug 2008
Posts: 5
The CONTROL->PLAY feature (same as pressing ENTER) in Flash does not run any actionscript. The sole purpose is to move the playhead. It is the same in AS2, so the real question here is "How are you getting it to stop in AS2 by using the CONTROL->PLAY feature?"
wessidemd is offline   Reply With Quote
Old 09-05-2008, 10:33 AM   #9
robh2255
Junior Member
 
Join Date: Sep 2008
Posts: 16
wessidemd, if you go to Control, check "enable simple frame actions", and then Control > Play, it will acknowledge the stop() in AS2 (and I assume other actionscript as well). I haven't used Flash CS3 much but I remember this working back in Flash 5 as well. I have more experience using Director where it's common practice to test on the timeline like this. I don't know why this feature would be removed in Flash CS3.
robh2255 is offline   Reply With Quote
Old 09-05-2008, 05:43 PM   #10
wessidemd
Junior Member
 
Join Date: Aug 2008
Posts: 5
Very interesting, I've never even considered testing my movie on the timeline. I've only used it to see where a particular tween would be at a particular time. I do know that playing the movie that way consumes a ridiculous amount of CPU resources.

I guess I'm not the person to ask in this case. Sorry I couldn't help.
wessidemd is offline   Reply With Quote
Old 09-24-2008, 01:22 PM   #11
robh2255
Junior Member
 
Join Date: Sep 2008
Posts: 16
Thanks anyway, wessidemd. I still haven't found a solution, but I'm making do without.
robh2255 is offline   Reply With Quote
Old 09-25-2008, 02:21 PM   #12
haplodotx
Junior Member
 
Join Date: Sep 2008
Posts: 2
I was able to duplicate this issue with a nested MovieClip with just 2 frames. Both frames have a stop();.

If I were to drag the MC manually onto the stage, the stop(); method would work and stop at the first frame. However if I were to add to the stage dynamically with addChild(), it won't.

When tracing in the frames, I found that the first frame has been skipped , none of the trace from the first frame showed up and went straight to the second. I solved it by adding an extra frame before the first stop();, it works and tracing shows that I'm on the first stopped frame.

Now, the question here is, why does this happen?

P.S.:
I've made a simple Test.fla to show how the issue can be reproduced.

Basically, there's a button to add the container from the library. Container has a nested movieclip with 2 frames, a stop(); on each. I've placed one of the Container onto the stage and when the button is clicked, it'll add Container (again) and Container2 onto the stage as well. All for comparison purposes only. I duplicated a Container2 with a MovieClipwith 3 frames, but stop(); on the last 2 only to show what I was talking about as a solution(?).

Code:
button.buttonMode = true; 
button.addEventListener(MouseEvent.CLICK, clickListener); 

function clickListener(e:MouseEvent) 
{     
    var container:Container = new Container();     
    container.x = 150;     
    container.y = 150;     
    addChild(container);         

    var container2:Container2 = new Container2();     
    container2.x = 150;     
    container2.y = container.y + container.height + 20;     
    addChild(container2); 
}
I've made a similar post here:
http://www.actionscript.org/forums/s....php3?p=794148

I hope cross-posting would be ok, otherwise I'll apologise in advance.
Attached Files
File Type: zip Test.zip (7.8 KB, 156 views)
haplodotx is offline   Reply With Quote
Old 09-25-2008, 05:39 PM   #13
robh2255
Junior Member
 
Join Date: Sep 2008
Posts: 16
Thanks for looking into that issue, haplodotx. Your example also gave me a better understanding of how to pull items in from the library which I've been struggling to grasp, so I appreciate the test file as well. Thanks!
robh2255 is offline   Reply With Quote
Old 10-23-2008, 07:25 AM   #14
nancyh
Junior Member
 
Join Date: Oct 2008
Posts: 1
Question more stop problems

I am making animations in Flash CS3. I do not know how to use Actionscript yet but I want to stop my animations so they do not loop in the swf files. I have added stop(); to a keyframe at the end of my timeline. Sometimes it works but most often it does not. Have tried this over and over again. What am I doing wrong? I am really tired of looking at the whole animation in test movie just to see if it is going to repeat.
nancyh is offline   Reply With Quote
Old 10-23-2008, 04:08 PM   #15
robh2255
Junior Member
 
Join Date: Sep 2008
Posts: 16
nancyh, I tried a test and had the same problem with animation looping repeatedly as well. Other people have had the same problem too.

You might check out this post though:

http://www.actionscript.org/forums/s...=159484&page=2

The person named "Mazoonist" provided an example which worked and didn't loop. But he put his movie clip animation inside another movie clip on the main timeline. So perhaps in order for this to work, you must create your animation inside another movie clip rather than directly on the main timeline.

I wish I knew more myself.
robh2255 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Actionscript 3.0

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:24 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.