A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Urgent help needed, please!

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    7

    Urgent help needed, please!

    Ok, I have a dropdown menu that is being called from the actionscript only. The submenu is nowhere on the actual flash stage. I have no idea how or where to add links to these submenu items. Here is the code.

    The submenu items are Beauty, Location, and Studio, any ideas on how to link these?

    menu = ["Beauty", "Location", "Studio"];
    xStart = 662;
    yStart = 190;
    bWidth = 79;
    bHeight = 17;
    interval = 50;
    countDown = menu.length;
    menuOpen = false;
    theTime = 0;
    buttonScrollSpeed = 2;
    for (var i = 0; i<menu.length; i++) {
    var b = this.attachMovie("subButton", "subButton"+i, countDown);
    countDown--;
    b.stop();
    b._x = xStart;
    b._y = yStart;
    b.interval = interval*i;
    b.target = yStart+(bHeight*i);
    b.txt = b.page=menu[i];
    b.onPress = function() {
    closeMenu();
    _root.pages.gotoAndStop(this.page);
    this.gotoAndStop(1);
    };
    b.onRollOver = function() {
    this.gotoAndStop(2);
    };
    b.onRollOut = function() {
    this.gotoAndStop(1);
    };
    b._visible = false;
    }
    function closeMenu() {
    for (var i = 0; i<menu.length; i++) {
    var b = this["subButton"+i];
    b._visible = false;
    b._x = xStart;
    b._y = yStart;
    }
    menuOpen = false;
    }
    mainButton.onPress = function() {
    if (!menuOpen) {
    theTime = getTimer();
    menuOpen = true;
    for (var i = 0; i<menu.length; i++) {
    _root["subButton"+i]._visible = true;
    }
    } else {
    closeMenu();
    }
    };
    function scrollButtons() {
    if (menuOpen) {
    for (var i = 0; i<menu.length; i++) {
    var b = this["subButton"+i];
    if ((theTime+b.interval)<getTimer()) {
    b._y += (b.target-b._y)/buttonScrollSpeed;
    }
    }
    }
    }
    this.onEnterFrame = function() {
    scrollButtons();
    };

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    http://board.flashkit.com/board/showthread.php?t=802112

    did this not answer your question ?

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Posts
    7

    Nope

    That's not what I need. I need them to open to seperate links not to seperate frames. Thanks though.

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    open to seperate links

    do you mean html links ?

    if so, alter the following lines in your code -
    PHP Code:
    b.onPress = function() {
    closeMenu();
    getURL(this.page+".html""_blank");
    // where the html links are - Beauty.html, Location.html, Studio.html
    // these correspond to the names in your menu array
    this.gotoAndStop(1);
    }; 

  5. #5
    Junior Member
    Join Date
    Sep 2009
    Posts
    7
    That seemed to work for 1 link but when I put in all 3 links it seems to open 3 different pages when I click on one link. I am getting very close though and that last line of code is just what I was looking for. I appreciate it a lot.

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    add a new function to the very end of your code -
    PHP Code:
    // <snipped the previous code for brevity>
    }
    this.onEnterFrame = function() {
    scrollButtons();
    }; 
    // this line was the end of your code

    // now add the new function here
    function openLink(mc,iVar){
    mc.onRelease = function(){
    closeMenu();
    mc.gotoAndStop(1);
    getURL(menu[iVar]+".html""_blank");
    }
    }; 
    PHP Code:
    // completely remove these lines of code -
    b.onPress = function() {
    closeMenu();
    getURL(this.page+".html""_blank"); 
    this.gotoAndStop(1);
    };

    // and in its place, add -
    openLink(b,i); 

Tags for this Thread

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