Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-23-2003, 05:12 AM   #1
Registered User
Join Date: Oct 2003
Location: Canada
Posts: 3
Send a message via MSN to cphunk
Default Target Previous Duplicate Movie

Hey everyone, I have a simple question for you. Hopefully someone can help here.

I'm currently duplicating a clip on the stage as a news item. The problem is. The textfield within the movie clip is resized based on the dynamic text's textHeight. The next duplicated movie must be placed so that it's 10px below the previous - dynamically sized duplicated movie. Do you follow me?

The problem is that, I can't get the previously duplicated clip's height. Is there a way to target your last duplicate somehow?

Here's the code:
You can even download the fla and text file here:

ActionScript Code:
n = _root.numberOfNewsItems;     objTexts = new LoadVars(); objTexts.load("newsText.txt"); objTexts.pntTimeline = this; objTexts.onLoad = function() { this.pntTimeline.dupClips(); };         dupClips = function(){    mc._visible = false;    for(var i = 0; i<n; i++) {          // duplicates mc and sets the text field to newsText.txt text var var pntThisDupe = mc.duplicateMovieClip("dupe"+i,i);  pntThisDupe.field.text = objTexts["text" + i]; pntThisDupe.date.text = objTexts["Date" + i]; pntThisDupe.field._height = pntThisDupe.field.textHeight; pntThisDupe.alphaClip._height = pntThisDupe.field.textHeight+10; // i thought the following would target the prev clip, but it doesn't          if(i > 0) {    var oneLess = i-1;    var newName = "dupe"+oneLess;      // traceing newName returns the correct previous clip    // but i cannot target it's values ..._y, _height for example    trace(newName);            _pntThisDupe._y = newName._height + 10; }             } };

Last edited by farafiro; 10-26-2003 at 03:01 AM.
cphunk is offline   Reply With Quote
Old 10-26-2003, 03:24 AM   #2
Addicted To FLASH
farafiro's Avatar
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro

welcome to the forums

the text's height won't reflect the real value befor it is fully loaded
so u do the duplication after u load AND display it
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
farafiro is offline   Reply With Quote
Old 10-26-2003, 03:33 AM   #3
Registered User
Join Date: Oct 2003
Location: Canada
Posts: 3
Send a message via MSN to cphunk
Default dup

The display and duplication is only done after the LoadVars has been successfully loaded. So it's actually being displayed properly.

I did solve the problem already. The issue was that the string needed to be eval'd to be used as a variable. Silly thing I should have known.
cphunk is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:32 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.