A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Executing actions only in duplicated mc's (& not in original)

  1. #1
    Junior Member
    Join Date
    May 2000
    Posts
    26
    A little hard to explain, so please don't hesitate to ask if you need clarification.

    I'm placing a mc on the main timeline for the sole purpose of duplicating it and manipulating the duplicated clips. I want to imbed behavior in all duplicated clips via the OnLoad and the OnEnterFrame events, but I don't want these events to fire for the original (non-duplicated) clip.

    I thought I'd handle this by placing "clipNo=0" on the first frame of the timeline of the mc, then set clipNo to 1, 2, etc.. as the clip was duplicated. Then in the OnEnterFrame event for the clip, I thought I could say "If this.clipNo <> 0..." to fire events only for duplicated clips and not the original. I realize this is not the most elegant way to accomplish this, so my first question is, what would be a better way to accomplish this?

    A "side-question" here. Within the OnEnterFrame event, if I refer to the variable set on the mc timeline as "this.clipNo", the variable is not found. If I refer to it as "_root.myMCname.clipNo" it is found, but I want to mc to be portable, so I don't want to put the specific myMCname from the main timeline in the code for the clip. How do I refer to a variable set in the mc timeline for this clip from within the clip actions if "this.clipNo" won't work.

    I've gone through the actionscript reference, but (obviously) missed something. Thanks for your help.

    Gary

  2. #2
    Hack
    Join Date
    Mar 2000
    Location
    Madison, WI
    Posts
    1,753
    I don't know why this.clipNo isn't working, it sounds like it should. One simpler way to do it is something like this:

    Name your original movie clip "original" and in frame 1:

    If (this._name != "original") {
    [duplicate movie clip actions]
    }

    Just don't give any of your duplicated movie clips the name "original".

    em

  3. #3
    Junior Member
    Join Date
    May 2000
    Posts
    26
    Thanks for the response, EM. You're right that checking the clip name would be a more logical way of executing events only for the duplicated clips, that's what I'll do.

    I also found why I wasn't able to access this.clipNo as I had expected to. First, the variable set in the first frame of the clip was not set by the time the OnLoad event fired. Secondly, I was making a stupid mistake and trying to set this variable in the first frame of the movie clip which *contained* the movie clip I was referring to. In other words movie clip B was contained within movie clip A which was on the main timeline. I was setting "clipNo=0" on frame 1 of the timeline for mc A, and then selecting mc B and checking for the variable in the clip event. This seemed logical at the time, because I was staying on the same screen the whole time (viewing mc A), but I was checking for a variable in mc B which was on the timeline of mc A.

    Thanks for your help,

    Gary



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