A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: what's wrong with this function code ?!?

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    116

    resolved

    Here's the function code I have in the main timeline:

    function submenu (here) {
    onClipEvent (enterFrame) {
    if (_root.here == false) {
    this.gotoAndStop(1);
    } else if (_root.here == true) {
    this.gotoAndStop(2);
    }
    }
    }


    ...is it because i have onClipEvent in the code?
    I have several mc's that need this code, and using a function would be a time saver....

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Posts
    443
    yes it is, so inside each mc, have an onCipEvent(enterFrame) that then calls the function...

    function submenu (here, where) {
    if (_root.here) {
    _root[where].gotoAndStop(1);
    } else
    {
    _root[where].gotoAndStop(2);
    }
    }

    where "where" is the mc name, which you can find out dynamically by _name

    swills

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Posts
    116
    Thanks!
    Would this be correct for the mc:

    onClipEvent (enterFrame) {
    function submenu(printInfo, this) {
    }
    }



    'where' would actually be a variable..but that shouldn't matter right.?

    'printInfo' is one of my variables





    for the function:

    function submenu(here, where) {
    if (_root.here == false) {
    where.gotoAndStop(1);
    } else if (_root.here == true) {
    where.gotoAndPlay(2);
    }
    }
    [Edited by flashkitok on 05-13-2002 at 04:18 PM]

  4. #4
    Senior Member
    Join Date
    Sep 2001
    Posts
    443
    No, not quite. the "here" is fine as it is just a variable that just gets tested, but the "where" variable is to be used as a path to an mc. So, either have "where" equal to an mc name that is on the _root, so then my original code works, or, have the full path in "where" (with _root included) and use eval(where) in the goto statement.

    swills

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