Click here to Skip to main content
13,549,303 members
Rate this:
Please Sign up or sign in to vote.
See more:

I've completed this tutorial -[^] but when I view the project on HTML the images don't stop and wait for you to hover over the thumbs, they play repeatedly for about 0.2 of a second each on loop! What am I doing wrong?

In the code the first step is;
btn1_btn.onRollOver= function(){

What is the significance of (1) - what does this relate to?

Posted 14-Jan-13 2:48am
Updated 14-Jan-13 3:36am
SAKryukov 14-Jan-13 14:11pm
Documentation on this API says it's a frame; must be a frame number.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Simple answer: Stop wasting your time with Flash. The world is abandoning it and any developer with any foresight will jump that ship right now - let alone teach yourself it! Adobe are gradually discontinuing Flash an shifting to HTML5/CSS3 - already Flash doesn't work on newer Android phones e.g. Galaxy S3 (basically, Jelly Bean).

I would suggest you start learning HTML5/CSS3 - the new(ish) standard though it's been around for a while now and is supported in all major browsers & IE9 (some bis are in IE8). Start here:

When you come to wanting to do slide shows, you have 2 options. Either go all out HTML5/CSS3 (and lose some browser support) by using CSS3 animations or go the JavaScript route in which case you're best to look at jQuery - by far the best/easiest. You can set up a slideshow less than 3 lines of code once you've learnt a little!

I realise this might be a bit of a learning curve with more to it before you reach doing slide shows, but it is certainly worth it! Especially if you are only just beginning with Flash (as it appears you are). No point teaching yourself an already outdated technology :)

Hope this helps,

Useful links:
jQuery tutorial:[^]
jQuery Website:[^]
milind-thakkar 15-Jan-13 4:45am
+5. :-)
EdNutting 15-Jan-13 14:09pm
Thanks :)
Alex-Sinclair 15-Jan-13 4:52am
Thank you so much for your response. At the oment I'm desperately working to finish a portfolio link so I can apply for a job. At this point in time I don't have the time to teach myself HTML5 but I will certainly be sure to rebuild in HTML5 in the future. In the meantime is there any advice you can give me on how to quick fix the error above?

EdNutting 15-Jan-13 14:14pm
May seem a bit dumb, but you do have the initial stop(); call at the start of your ActionScript, right? If not, your flash show would play each frame at standard frame rate (which I think is 0.2 frames per second ish) - it would explain why it isn't working properly. Please see this quote from the article you linked to:
"We will now stop the movie from playing these frames without us telling it to do so, click on the very first frame in the layer named Actions and then press F9 to open up the ActionScript panel (or go to Window>Actions). Simply type Stop(); to stop the movie from playing those frames automatically." and refer back to the article screenshot provided too.

Hope this helps - it's the only thing I can think of that could be wrong!
Alex-Sinclair 16-Jan-13 5:02am
Thanks Ed, I'll try this tonight. Do I only have to do this once at the beginning as instructed? Or before each goandstop command? Apologies, I'm a complete beginner!

EdNutting 16-Jan-13 7:50am
You should only have to do it once at the very start since "goandstop" will go to the specified frame and then call stop for you. Stopping before the "goandstop" command would make no noticeable difference since goandstop would change the frame immediately afterwards.

Just in case, here's some possibly helpful info:
Flash files are animations (or movies) and, just like any movie, they have frames. Just like you'd expect from a film, it's default aim is to play the frames at a set frame rate and produce an animation. So when you open a Flash file, by default, it just starts playing. However, you are trying to produce a mini application in which the movie only "plays" (i.e. goes to the frame you want) when the user generates some input (i.e. clicks/hovers over a button). Since you want the first frame to be displayed and then the movie to stop, your code must override the default playing state by calling "stop()" at the very start of the movie. Thus the first frame is shown. Then, when a user hovers on a thumbnail, you call goandstop, which plays the movie from the current frame, straight into the specified frame (ignoring any inbetween). It then calls stop to prevent the movie playing any subsequent frames. Thus you get the affect of going to a particular image :) It is helpful to always think of Flash files as movies but with events and code that can change how the movie behaves.

Hope this helps,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02-2016 | 2.8.180515.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100