A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: More than 1 instance name to a single MC?

  1. #1
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51

    More than 1 instance name to a single MC?

    Hey,

    I'm using CS3 and want to know if it's possible to give more than 1 instance name to a single MC using AS2?

    The reason I ask is I have a bunch of templates that I want to load (one at a time) into a master swf that will be used for scaling & positioning of movie clips (which data will be saved to an XML file) in all the loaded swf files. I would like to have some code in the loaded clips that the master swf could use for controlling it's movie clips. This code would reassign the clips a second name so the master swf recognizes the clips in the loaded swfs and is able to manipulate them.

    The problem now is I have a lot of template swf files with all different named movie clips and changing all of there instance names one by one will take a long time.

    I imagine that unless the clips were allowed 2 different names and were just assigned a new one, that it would stop any preexisting code from working correctly.

    Any ideas are very appreciated!

    Thanks,

    Spit

  2. #2
    Senior Member
    Join Date
    May 2010
    Posts
    178
    It sounds like you might need to redefine what you are doing now.Make a sample to describe it better. You can rename the instance name of a MovieClip by code. But I don't actually understood what you are going to acomplish.



    poltuda

  3. #3
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    Thanks for your feed back poltuda. I actually started rethinking the project a little before I saw your post, still not sure how to approach it yet.

    What I am working on is a CMS type of thing that will be used locally only. I want other people I work with to be able to change the info in these swf templates that pull information from an XML document. I want to build a swf interface that they can edit basic things in these templates like changing text, colors, fonts...etc... I have figured out how to use php to send changes to the XML from a swf interface. My problem is that all of these templates have movie clips with different instance names. If I could give these MCs a second instance name, I could use that to pull in all the info as changes are made with the same code using the second instance names. This way the existing templates will still work as they are coded and labeled by using their existing instance names.

    Does this make sense? And is it possible to have MC's with multiple instance names?

    Thanks again for your time,

    Spit

  4. #4
    Senior Member
    Join Date
    May 2010
    Posts
    178
    Actionscript Code:
    var i = 0;
    var mc = clip;
    var num = "clip";
    btn.onRelease = function() {
        i++;
        mc._name = num+i;
    };
    clip.onRelease = function() {
        trace(this._name);
    };

    This will change the instance name of the clip MovieClip to clip1, clip2 and so on. Will this solve your problem?



    poltuda

  5. #5
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    This might do it... I'll give it a try at home tonight. Thanks!

    One more question if you don't mind...

    If I rename a MC, make it do a series of things with that name, and then return it to it's original name... would there be any reason any coding that existed prior to it being renamed and then changed back to it's original name wouldn't work?

  6. #6
    Senior Member
    Join Date
    May 2010
    Posts
    178
    I am not getting any reason to do what you are trying for your application. Please make a sample of what you are trying. This might help you to get good solutions.


    poltuda

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