dcsimg
A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: Flash button Help

  1. #1
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10

    Flash button Help

    So I'm designing a web site in flash (MX on a Mac), and it's come to my attention that everything works perfectly when buttons are clicked once.. but if a user double-clicks a button - things get messed up.

    This is a problem I've never encountered before - and I was wondering if anyone has had this problem, and might be able to offer a solution.

    The site can be viewed at:

    http://www.uniquerestoration.ca/testing/

    thanks so much in advance for any help!

    emalen

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Hard to say without seeing your .fla.

  3. #3
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    I've posted my flash files here:

    there are three... the home file, then to other movies

    i have no idea if this will help, but i'm quite desperate at this point!

    you can download them here:

    http://www.uniquerestoration.ca/flash/

    new_unique.fla is the home file

    then you can click featured projects (featuredprojects.fla) then 1155 bough beeches, (fp_1155bough.fla)

    any help is appreciated.

    emalen

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Suggest you "disable" ALL your buttons on a first press or release, in this manner...
    code:
    on (release) {
    if(_level0.current_selection == "featured"){
    stop();
    } else {
    loadMovie("featuredprojects.swf", _root.loadTarget);
    _level0.current_selection = "featured";
    }
    }

    // On the SERVICES button...

    on (release) {
    if(_level0.current_selection == "services"){
    stop();
    } else {
    loadMovie("featuredprojects.swf", _root.loadTarget);
    _level0.current_selection = "services";
    }
    }
    // And so fourth on ALL buttons.



    Then you'd probably have to do someting in the same manner in ALL your buttons in the "featured.swf"...
    code:

    on (release) {
    if(_level0.current_subselection == "bloor"){
    stop();
    } else {
    loadMovie("fp_2bloor.swf", _root.loadTarget.loadprojects);
    _level0.current_subselection = "bloor";
    }
    }

    //And on ALL of your other "sub" buttons...


  5. #5
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    Thanks so much for you assistance.

    Not being a flash action script expert, I can only ascertain that the script you posted will disable the button after it is clicked.

    My only question is that it seems that the button is never able to be clicked again after...

    is there away to allow it to activate after a few second?

    as I am worried a user may go back to click on the button, and be frustrated as it isn't clickable.

    Thanks so much for your assistance, it is great appreciated.

    emalen

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You have to code ALL of your buttons in the same manner. Each button is in fact only disabled if that selection is already up. If you press another button, which changes the value of the common variable _level0.current_selection, then pressing the previous button will work, because the variable no longer contains the previous value, which kept the button from working.

  7. #7
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    One more question: (hopefully!)

    When you name the subselection:

    _level0.current_subselection = "bloor";

    is "bloor" just a random text you've used.. is there a reasoning behind it?

    thanks again,

    emalen
    Last edited by emalen; 07-20-2004 at 12:11 PM.

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    ...And? What's the question?

    It's just pertaining to the button that's being pressed. It could be any value, I just used something descriptive in relation to each button... If that was your question.

  9. #9
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    I'm back....

    so here's the issue. apparently, double clicking on the link isn't messing up the movie.... it is clicking on a new link, while the old link is loading...

    oldnewbie - if you have another ingenious solution up your sleeve... i would worship the ground you walk on!

    emalen

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Well disabling the buttons as I suggested should do it! You could also use "press" rather than "release"...

  11. #11
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    Dear oldnewbie (or any flash guru!),

    If you get a chance, please take a look at

    http://www.uniquerestoration.ca/final2/

    I implemented your code on all my buttons so that users can only click once.... which is fine. Users can now only click once....

    BUT if a users loads a movie

    then clicks WEATHERPROOFING.. while masonry repairs is loading....... the whole flash piece gets messed up and goes into a strange loop.

    Is it possible my preloader is poor and messing things up? or my use of levels is incorrect?

    any help is appreciated.

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    And you've implemented my code suggestion on all of those buttons also?
    What does your preloader code look like?

    Are you loading your movies allways on the same level, or in the same movie clip container?

  13. #13
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    Sorry,

    my post doesn't seem to be appearing properly, with all the code, so i've posted it at this linK:

    http://www.uniquerestoration.ca/flash/post.html
    Last edited by emalen; 07-20-2004 at 03:26 PM.

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Yes the preloader might well be the culprit. I've never really used or created a preloader with setInterval, and think it would of been much easier to just use one single generic preloader, within your main movie, to load all of your external movies...
    That said, I think that what's happening is that, since you're only clearing the interval when a loading movie has been fully preloaded, hitting another button to preload another file (thus setting up a new interval) while the other interval is still running and hasn't been cleared, is in fact what's causing your movie to go wild.
    I'd try another preloader (without setInterval) in one section, or at least attempt to clear any running interval before setting a new one (when loading another movie), thus first clearing the maybe running interval on each of your buttons' scripts.
    Might be easier to just use a generic preloader within the main movie!

    If you ever want to try one...

    http://members.fortunecity.fr/fgill/genericpreload1.htm
    Last edited by oldnewbie; 07-20-2004 at 05:14 PM.

  15. #15
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    So I've accepted the fact i have to change preloaders....

    Can I link each file to the same external preloader?

    if so, do you have a script suggestion I should use...

    I downloaded the link you sent me too, since i'm a apparently a flash idiot, i have no idea how to implement it to my site!

    thanks again,

    emalen

  16. #16
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That's my generic preloader example... Let me see if I can implement it in your .flas, but possibly only later tonight... No promises though!

    I would need links to your sub .swfs (a few at least!), cleared of their preloaders.

  17. #17
    Junior Member
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    10
    Wow, you've gone above and beyond the call of duty. I can't thank you enough. I've posted osme files online... if you have any free time!

    http://www.uniquerestoration.ca/testing/

    all preloaders have been removed as requested.

  18. #18
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Will see what I can do in the morning... Going to get some sleep now!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center