A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: menu issues

  1. #1
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399

    menu issues

    This is a working demo of the action script used for my nav system

    The idea is if you roll over a white box the sub menu fades in (in this case a red button)

    Now my issue was found from me fiddling around to much.. the concept is if you roll over a second white box the first sub menu fades out as the second fades in...

    Now the issue is.. sometimes if you move your mouse quickly over 2 or 3 boxes at once.. all the sub menus can be faded in at the same time... i need a way to prevent this... any ideas?

    Is there a better way to set this up?
    Thanks
    Attached Files Attached Files
    "what the hell's a tween?"

  2. #2
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    you could disable all the other on rollOver Actions until the button reaches the frame where it is stopped and showing.

    I would use an entirely different approach though because I find it time consuming to edit and difficult to control the movie properly with code spread about like that.

    Have a look at this alternative way...
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  3. #3
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399
    I like where that's going.. however I don't think I want to control btn1 thru 3 from the first frame of the movie..
    as in on(press) gotoAndStop(2);
    there will be mutliple movie clips within each sub nav.. i guess the example would be.. 10 red buttons under each

    I'm not sure how to edit what you've given me to accomedate that

    but it looks great
    "what the hell's a tween?"

  4. #4
    You again?!?!?! gunko2's Avatar
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    171
    wow man!
    too much work for a simple nav....
    i'll post a fla. later that makes the same thing but more efficient....

  5. #5
    You again?!?!?! gunko2's Avatar
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    171
    ok here u go:
    Attached Files Attached Files
    • File Type: fla a.fla (28.0 KB, 26 views)

  6. #6
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    gunco, nice but how is it more efficient when you have onEnterFrame actions contantly active?

    Also the red buttons arn't clickable as they disapear on roll out of the movieClip that summons them and they have no code attached.
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  7. #7
    You again?!?!?! gunko2's Avatar
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    171
    i know, i know!
    my bad!
    when he posted the question i "scanned" it quickly and only saw the words fade in, actionscript, roll over, prevent this and any ideas....
    so sorry man! if u want to i will delete the masage i wrote....

  8. #8
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    no worries Gunco,

    Jordslaght, to show how to get this working properly as a navigation system I have posted another example. This file has 2 versions, the first runs a generic goto function for each button and the other allows you to execute a separate function for each button in the submenu.

    To add links simply edit the buttonNames array and add the appropriatley named movieClips into the appropriate sub menu.

    Follow the naming convention for all sub menus, buttons and frames and all should work fine...
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  9. #9
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399
    Oh this is great!
    this last version works exactly how i need it, much more efficient. a little above my skill level.. action script wise.. but this is great thank you

    one quick question:
    I would rather have the menu system simply fade in.. and have no scaling at all.. i'm trying to play witht hat but can't seem to make it work properlly.. thanks a lot
    "what the hell's a tween?"

  10. #10
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399
    Here is the AS for anyone that doesn't want to bother with the download to help with my issue

    As stated above it works perfectly.. i'd just like to take of the scaling

    A simple fade in and fade out (like it already does) but without scaling x & y

    thanks in advance

    code:

    var numSubs = 3;
    var xOffset = 150;
    var yOffset = -30;
    var speed = 2;
    var buttonNames = new Array();
    buttonNames[0] = ["link 1","link 2","link 3"];
    buttonNames[1] = ["link 1","link 2","link 3","link 4"];
    buttonNames[2] = ["link 1","link 2"];
    function initialiseLinks(){
    for(i=1;i<=numSubs;i++){
    this["mc"+i].id = i;
    this["mc"+i].onRollOver = function(){
    for(n=1;n<=numSubs;n++){
    sub = this._parent["sub"+n];
    if (n==this.id) {
    var j=buttonNames[this.id-1].length-1;
    for(i in sub){
    sub[i].id = this.id;
    if(typeof sub[i] == "movieclip"){
    sub[i].desc.text = this._parent.buttonNames[this.id-1][j];
    sub[i].onRelease = function() {
    this._parent._parent.moveTo(this.id,this.subid);
    this.gotoAndStop(1);

    }
    sub[i].onPress = function(){
    this.gotoAndStop(2);
    }
    sub[i].subid = (j--)+1;
    }
    }
    sub.onEnterFrame = showme;
    } else {
    sub.onEnterFrame = hideme;
    }
    }
    }
    sub = this["sub"+i];
    sub.x = sub._x;
    sub.y = sub._y;
    sub._x += xOffset;
    sub._y += yOffset;
    sub._alpha = sub._xscale = sub._yscale = 0;
    }
    }
    MovieClip.prototype.showme = function(){
    if(this._xscale<100) this._alpha = this._xscale = this._yscale += (100-this._yscale)/speed;
    this.dx = (this.x-this._x)/speed;
    this._x += (this.dx>0&&this.dx<.1) ? .1 : (this.dx<0&&this.dx>-.1) ? -.1 : Math.round(this.dx*10)/10;
    this.dy = (this.y-this._y)/speed;
    this._y += (this.dy>0&&this.dy<.1) ? .1 : (this.dy<0&&this.dy>-.1) ? -.1 : Math.round(this.dy*10)/10;
    if(this._x == this.x) delete this.onEnterFrame;
    }
    MovieClip.prototype.hideme = function(){
    if (this._xscale>0) this._alpha = this._xscale= this._yscale += (0-this._xscale)/speed;
    this.dx = (this.x+xOffset-this._x)/speed;
    this._x += (this.dx>0&&this.dx<.1) ? .1 : (this.dx<0&&this.dx>-.1) ? -.1 : Math.round(this.dx*10)/10;
    this.dy = (this.y+yOffset-this._y)/speed;
    this._y += (this.dy>0&&this.dy<.1) ? .1 : (this.dy<0&&this.dy>-.1) ? -.1 : Math.round(this.dy*10)/10;
    if(this._x == this.x+xOffset) delete this.onEnterFrame;
    }
    function moveTo(sec,subsec){
    gotoAndStop("frm"+sec+"_"+subsec);
    }

    "what the hell's a tween?"

  11. #11
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You could scale down your signature graphic though! 300*40 MAX here on FK!

  12. #12
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399
    only if that gets me an answer from you
    yeah sorry about that.. didn't realize.. it was ugly anyways
    "what the hell's a tween?"

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I think the "monkey boy" should be the one answering you!

  14. #14
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399
    okay so not working as well as i had hoped...
    perhaps it has to do with the scaling issue... i have small jpg's in each sub menu item (i'm using the individual functions version) and when the sub menu fades in to place.. after it's done the images vibrate.. it's a strange effect.. it's like it's not quite scaled all the way and it can't figure out which pixels to display the images with..
    "what the hell's a tween?"

  15. #15
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    Mornin,

    heres 2 more version -

    one that snaps to a pixel rather than .1 of a pixel, hopefully should fix any problems with using bitmap instead of vector graphics.

    the other does the fade only.
    Last edited by Lexicon; 09-24-2004 at 03:09 AM.
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  16. #16
    Senior Member jordslaght's Avatar
    Join Date
    Jul 2001
    Posts
    399
    i'm glad I stayed up for your response, as it's now 2 AM here i'm off to bed.
    thank you very much for these examples
    "what the hell's a tween?"

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