3 Replies Latest reply on Aug 27, 2009 1:17 PM by Ned Murphy

    attaching same code for multiple instances (AS2)

    Flanders_ZA-IgqhAi Level 1

      Hi, clueless here.

       

      I have the following code on frame1 of my movie that I want to apply to multiple instances of the same movie clip:

       

      mainClip_mc.subClip1_mc.specifiedClip_mc.onPress = function  () {

            //code begins

       

       

       

       

      specifiedClip_mc exists in subClip1 through 4. Is there a way to do this once without having to say:

       

      mainClip_mc.subClip2_mc.specifiedClip_mc.onPress = function  () {

            //same code

       

      mainClip_mc.subClip3_mc.specifiedClip_mc.onPress = function  () {

            //same code

       

      mainClip_mc.subClip4_mc.specifiedClip_mc.onPress = function  () {

            //same code

       

      Essentially, specifiedClip_mc's parent clip is what's throwing me here.

      The code to be applied to specifiedClip_mc is identical and I can't help but feel I'm not going the correct route by doing this the long repetitive way.

       

      Any help for this newb would be greatly appreciated.