Welcome, Guest
  • Author Topic: Making a dynamic text in flash a button/link  (Read 1224 times)

    gee

    • Server what's that
    • *
    • Posts: 21
      • View Profile
      • Email
    Hello everybody,

    I've got  problem which i cope with for a while, and i hope you can help me....

    I want to have something what makes a button or some kind of link of dynamc loaded text.

    I know how you can do this with fake buttons, but this doesnt ork very well...

    i want to make something, maybe a movieclip, with in it a textfield (dynamic) and a button.
    And this movieclip must duplicate itself, according to the number of rows in mysql...


    I dont know a script to do this....... can you plz help me....

    i need a script that duplicates  movieclip according to the number of mysql rows. and a script that can make dyn text a button...


    GREETS PETER

    gee

    • Server what's that
    • *
    • Posts: 21
      • View Profile
      • Email
    Re:Making a dynamic text in flash a button/link
    « Reply #1 on: 02/23/04, 06:31 »
    Ive got this script from a friend:


    for (i=0; i>totaal_variabelen; i++ {
    duplicatemovieclip("titel");
    myButton.onPress = function () {
       trace ("onPress called");
    };

    }


    but i dont know how this script works exactly, PLZ HELP

    Matthew Armstrong

    • Server what's that
    • *
    • Posts: 37
      • View Profile
      • Email
    Re:Making a dynamic text in flash a button/link
    « Reply #2 on: 02/23/04, 10:16 »
    Hi gee,

    not really a database issue (probably would have been better posted elsewhere in the forums) but here goes.

    I have created some code for you to dissect :


    //:::: Create an array to populate menu - normally gained from a DB call
    menu_items = [
                "one",
               "two",
              "three"
             ];

    function prepMenu(){
                  //calculate how many menu item to create
       var arrayLen = menu_items.length;
                  // loop through the array to create menu items
       for(var i=0; i<arrayLen; i++){
          createMenuItem(i)
       }
    }

    function createMenuItem(index){
                   // Create a menuitem (empty clip)
       this.createEmptyMovieClip("menuItem"+index, index);
       this["menuItem"+index]._x = 50;
       this["menuItem"+index]._y = 20*index;
                   // give the clip a label
       this["menuItem"+index].createTextField("label_txt", 0, 0, 0, 100, 100);
       this["menuItem"+index].label_txt.text = menu_items[index];
       // some action when clicked on
       this["menuItem"+index].onRelease = function(){
          trace(menu_items[index]);
       }
       
                   // change colour when rolled over
       this["menuItem"+index].onRollover = function(){
          this.label_txt.textColor = 0x0000ff;
       }
                   // change colour back when rolled out   
       this["menuItem"+index].onRollout = function(){
          this.label_txt.textColor = 0x000000;
       }
    }

    prepMenu();

    See how you go with this.

    Regards,
    Matt

    gee

    • Server what's that
    • *
    • Posts: 21
      • View Profile
      • Email
    Re:Making a dynamic text in flash a button/link
    « Reply #3 on: 02/23/04, 11:06 »
    Thanx mate...

    I'll go and try it out

    GRTZ Peter