A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Movie Clip Madness

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Hello All,

    I have a movie clip inside of my main movie clip where I've emulated a drop down menu. User clicks on a down arrow and the choices appear below that. To do this, I have a number of movie clips nested inside each other and things are working brilliantly. (I used a tutorial from this site to make it work.)

    The problem is, I want to duplicate the movie clip, as I need another drop down menu, but all of the actions and the source for the next movie clip need to be changed. I've duplicated the top level mc and given my new mc an instance name (called Classification), but whenever I try to edit the nested movies, everything in the first drop down that I have working changes to the new code and no longer works.

    Your help is appreciated.

    ~rockyroad


  2. #2
    Senior Member
    Join Date
    Mar 2001
    Posts
    146
    You dont have to script inside of movies.

    you can target and set clip properties from anywhere.

    you might set a variable

    dropDownMenu1.subOption1="what";
    dropDownMenu1.subOption2="ever";
    dropDownMenu2.subOption1="another";

    you can also set functions

    dropDownMenu1.buttonPress=function(subOption){
    _root.gotoAndPlay(subOption);
    }

    You could design your movieclip buttons to have simple functions,

    //inside the dropDownMenu
    on(press){
    this.buttonPress(subOption1);
    }

    and use instances of this moviclip named dropDownMenu1, dropDownMenu2 on the stage.

    Hopes this makes sense!

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Reconnect,

    Thanks for your speedy response. I'm not sure if I can do what you're talking about because the lists are dynamically loaded from SQL (through ASP). The select box that I have right now is set up as a dynamic hierarchy. One select box, goes through 4 iterations to get the inputs. So for example, the select box says: choose a "mylevel". (Where mylevel is the level variable where the user is at.) User picks the first choice, then a trip is made to the server and gets the second-level inputs related to that choice. The mylevel variable, get iterated each time the user selects a choice until the user is at the lowest level. Once the user gets to the bottom of the hierarchy, there are different actions that need to be performed than there are at all the other levels when the user clicks their selection (I have new dialog boxes popup, etc.). I probably could have used arrays, but because of the size of some of these input lists, the initial time to load the page could take a long time.

    Also, I don't know how many choices will be returned from the database, so I'm using scrollbars, which I think requires actions inside the mc, but I could be wrong (I'm relatively new to Flash). I would post the code, but as you can imagine, it's pretty convuluted.

    Any other ideas?

    ~rockyroad

  4. #4
    Senior Member
    Join Date
    Mar 2001
    Posts
    146
    when you say lists do you mean options in the dropdown menu?
    are you are wanting to generate dropdown menus based on data from the server?

    you can do anything with flash...

  5. #5
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Yep, I meant options and the options are being populated by the server. The lengthy paragraph above is all working (amazingly), the problem is I'm trying to reuse the movie clip (and all the mcs nested inside) that does all that. Do I have to duplicate every nested movie clip within this mc to be able to make this work?

    Thanks!

  6. #6
    Senior Member
    Join Date
    Mar 2001
    Posts
    146
    ideally you should create a function that populates an empty frame work. For instance

    Make a clip that houses a button, a dynamic textfield.

    give the text field a name (like name!) and attach some functions to it

    on(rollover){
    buttonOver();
    }
    on(press){
    buttonPress();
    }

    now you have a graphical representation of a menu option(optionButton).

    you can now make constructor functions for different types of button. If you sub option was a link to an external site you could make a function like this

    function linkButton(name,URL){
    _root.depth+=1;
    _root.attachMovie("optionButton",name,_root.depth) ;
    var mov=eval("_root."+name);
    mov.name=name;
    mov.link=URL;
    mov.buttonPress=function(){
    getURL(url,"_blank");
    }
    return eval(mov);
    }

    this function creates a copy of your optionButton, populates it with the relevant information (passed as arguments), then returns the movieclip.

    you can now make a link button using the syntax

    flashKitLink=new linkButton("FlashKit","http://www.flashkit.com");


    you can then use a script to create a collection of links.


  7. #7
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    So, if I get what you're saying, instead of having the onclick script attached directly on the button, I should just feed all the variables I need into a function that exists at the root level that gets called when the user clicks the button. That makes sense and is a much smarter approach.

    Thanks for all your help reconnect.

    ~rockyroad

  8. #8
    Senior Member
    Join Date
    Mar 2001
    Posts
    146
    are you good with SQL?
    i can code Actionscript no problem and would like to develop some dynamically produced flash apps. I would like to learn more about SQL and similar. We could maybe create a system that could just be dropped in configured. Maybe produce some tutorials? I working on a game at the minute and was hoping to have a high score system using SQL. Ill email the game over if you interested, i am interested in feedback.

  9. #9
    Senior Member
    Join Date
    Mar 2001
    Posts
    146
    function dataStore(name,URL){
    _root.depth+=1;
    _root.attachMovie("dataStore",name,_root.depth);
    var mov=eval("_root."+name);
    mov.loadVariables(URL);
    return eval(mov);
    }
    var request="getVars.asp?type=links";
    links=new dataStore("links",request);

    linksArray=new Array();
    for(var link in links){
    var newLink=eval("link"+link);
    var button=new linkButton(newLink,eval(link).toString());
    with(button){
    _x=50;
    _y=_height*linksArray.length+1;
    }
    linksArray.push(button);
    }

  10. #10
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Reconnect,

    Send me the game and I'll take a look. SQL is pretty easy to learn (at least the basics of it). Send me some more specifics of your project at alauseng@yahoo.com. I'm taking the rest of the day and the weekend off, so probably won't get back with you til early part of next week.

    ~rockyroad

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