dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: image gallery - instance name

  1. #1
    endless possibilities MadDog 555's Avatar
    Join Date
    Aug 2004
    Location
    planet earth
    Posts
    347

    image gallery - instance name

    im creating an image gallery and a have 45 buttons.

    i want to make a function and put it on the first keyframe of my movie that says:

    on(release){
    picture_mc.loadMovie( [instance name] +.jpg)
    }

    and than i would just have to call the function on each button.

    how do i do this???


    thanks!
    austin

    endless possibilities

  2. #2
    Senior Member Dricciotti's Avatar
    Join Date
    Aug 2002
    Posts
    2,988
    Give each of your buttons instance names of button0, button1, button2,...button44. Then, the following code will assign each of those buttnos the onRelease code that you want it to have. Depending on how you named you jpegs you will have to do one of two things to load the right jpeg. The easiest way would be to give them all names of image0, image1, image2,...image44. Then the following code woud work fine.
    code:
    for(i=0;i<45;i++)
    {
    _root["button"+i].tag = i;
    _root["button"+i].onRelease = function()
    {
    picture_mc.loadMovie("image"+this.tag+".jpg")
    }
    }



    If the images done have similar names, you would have to use an array or something to store the names of the different clips.

    Does the make sense?

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