-
I'm not sure what you're asking about duplication but the code I gave you is what you are trying to do. You can use attachMovie to create instances of the clip in your "library," or you can make duplicates of a clip on stage. They are exactly the same other than where the original clip is located.
Here is the same code using attachMovie instead
Code:
for(var i=0;i<aFeaturedVideos.length;i++){
// mcItemHolder.mcItem.duplicateMovieClip("mcItem_" + i,100+i);
mcItemHolder.attachMovie("mcItem","mcItem_" + i,100+i);
var mcNewItem = mcItemHolder.mcItem["mcItem_" + i];
mcNewItem._y = i * 90;
mcNewItem._x = 0;
mcNewItem.mcPlaying._visible = false;
mcNewItem.mcTitle.text = "Featured Videos Number " + i;
mcNewItem.sItemType = "featuredVideos";
var nTextHeight = mcNewItem.mcTitle.textHeight;
mcNewItem.mcTitle._y = Math.floor((80 - nTextHeight)/2);
}
I think this is the code you want. No worries at all if you don't want to use it now.
-
Good day,
thanks for the reply. I am sure you do want to give me a hint here, but I don't exactly know how to start off. I can't make it work...
I need to create a aFeaturedVideos array plus a mcItemHolder clip with a nested mcItem in it?
-
Hi, i meant to post again but my internet connection is down so I'm using the cell phone. I have attached a ball clip on stage like in Fuit's exmple and it is placed in the proper random position along with the text from the attached clips named ""+i. Can someone see why the rest of my clips stay in one place or point me the way to trace their names? I' lost again
-
Originally Posted by capdetrons
Good day,
thanks for the reply. I am sure you do want to give me a hint here, but I don't exactly know how to start off. I can't make it work...
I need to create a aFeaturedVideos array plus a mcItemHolder clip with a nested mcItem in it?
lol no. It's example code.
Your arrays can be whatever, your clips can be whatever. The example show how you can create instances/copies of a clip, place it on stage, set its vars, etc.
You previously said that it wasn't the code you need. The only thing I could see that you were doing differently was attachMovie instead of duplicateMovieClip. So I swapped them to show you that they're the same.
-
God! I didn't want to give up... I was encouraged not to do so in some forum, maybe here. I try... But I keep cracking up. I sort of understand your code, Moot. It makes sense, but isn't mine similar somehow? I' using a clip to attach others when an event is fired. I don't think I could possibly create any loops to rename my attached clips. I' increasing a variable each time my clip with the onSoundComplete fires, then I rename my clips and there's when I get lost. If you've previewed my fla, you'll have seen it runs alright the first 2 times... I don't know if I,ll ever see why. Can you clearly see why it's always attached at the same coordinates after that?
-
Finally !
-
It's because you have code IN the clip. That code should be in the main as. All these mystery problems you're having will clear up when you get your code in one place.
-
Got it, or at least something close to what I want to achieve. Thanks. Yes, I realized the code was running from the wrong place.
I need to keep experimenting because I now want to fade out my clips again and I wasn't sure whether the text object was treated individually or the clip's alpha would take care of its alpha (the text's).
In fact, I'm still not... but I'm on it.
thanks
-
Yes, whenever you start to wonder, remember all the natural rules apply.
The clip is an object. If you move the object, everything in the object goes too. If you move a box, the contents also move. Like the natural world, the objects in the box don't move in relation to the box, it's the box that moves.
So the book inside the box has an x of 100, the box gets moved 1000, the book still has an x of 100. Just like it still has an alpha of 100 but the box's alpha is 0.
If you use your imaginary wizard skills in the real world and render a box invisible, I would expect your spell to include the boxes contents.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|