Clicking a link twice causes the flash player to jump to the next frame.

Posted on 2005-05-09
Last Modified: 2010-05-19

I have built a flash program for a products parts list.
The program has the product split into it's key assemblies and displays zoomable 3D line drawings of each assembly so that each area can be zoomed and then individual parts click on to view their information.

I have a problem where a link is clicked, which causes the movie to jump to a certain frame, but if the same link is clicked again, it jumps to the next frame, even though it is already on the desired one.

I am looking for the best solution to solve this as it is a regular occurance to have the same part listed twice on the scree, ie: two bolts the same or something.
This means that if the user clicks one of the bolts, it goes to, say, frame 6, then they click the other bolt to check if it is the same, it goes to frame 7 which is the description frame of the nut.
The program also has litteraly hundreds, maybe even thousands of links in it already so i am trying to find a solution that will mean we don't have to change every single link already created.

It may also be important to know that the program is CD based using the projector file, rather than embedded in an HTML document. This has meant the use of any dynamic or server side content has been prohibited, however we have used mostly external txt and swf files to compile everything meaning updates are easy and possible future HDD installations should be easily managed and updateable.

Any help would be greatly appreciated.


Question by:MarkOs
    LVL 39

    Expert Comment

    what code are you using to go to the links?
    LVL 1

    Author Comment

    Damn, should have known you were going to ask that straight away!!!

    Here is an example:

    on (release) {
    loadText = new LoadVars();
    loadText.onLoad = function() {
                      desc.html = true;
                      _parent.desc.htmlText = this.desc;
                      number.html = true;
                      _parent.number.htmlText = this.number;
                      qty.html = true;
                      _parent.qty.htmlText = this.qty;
                      desc2.html = true;
                      _parent.desc2.htmlText = this.desc2;
                      number2.html = true;
                      _parent.number2.htmlText = this.number2;
                      qty2.html = true;
                      _parent.qty2.htmlText = this.qty2;


    With the gotoAndPlay command, frame 12 will have a stop() command on it so that the player stops.

    LVL 39

    Accepted Solution


    apart from the frame problem, is this loading of the txt file working properly?

    reason I'm asking, I'd say it's bad form to have all this on a onRelease on the clip/btn itself.

    also, u're setting qty.html to true, then setting the text of _parent.qty.htmText = "" - why? Surely it should be without the _parent in all instance or with (depending on your file setup)

    is the stuff that's being loaded going into the content on frame 12?

    i was able to recreate the error, here's the easiest suggestion.

    simply change your code to gotoAndStop(12) ...

    also, i'd suggest you remove your loadVars bits of code onto the frame, that way you won't be loading stuff unnecessary (though its run on CD you won't have issues with bandwidth).

    LVL 1

    Author Comment

    Haha, yes, the text file loading does work - miraculously!!
    This side of it was coded by someone else as I am not much of an actionscripter and i see your point - it does look a bit odd - however, due to the work it would create, i think i'll apply the "if it aint broke, don't fix it rule"  :o)

    Anyway, i had a sneaking suspision that gotoAndStop would be the key but hadn't realised it until i wrote all this!
    Either way, it's a mammoth task to change each one manually.
    Do you know if there is any kind of search and replace function for all actionscript in an FLA? Keeping in mind it would need to be a viewable thing so that we can only change the ones that need changing?

    Thanks very much for your help so far too.


    LVL 39

    Expert Comment

    what version of flash are u using, in flash mx 2004 pro, use the find and replace option in the edit menu. > specify current document. Don't see anything in flash MX.

    for future reference, for these exact reasons, advisable to use generic methods and call them, thus only need to make changes in one place :-)

    good luck.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
    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…
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now