[Flash 8]Figuring out total height of attached MCs

This may sound a bit redundant if you read my other post today about text, but i have another question regarding this scrollpane thing. So, again I have a movieclip called “entry” with textfileds (basically it’s just a header bar and a bottom border bar with two textfields). This is dynamically attached based on the number of xml nodes into a holder clip.

My question is, can i figure out the total height of the attached entry clips? The scrollpane i have so far scrolls to a fixed height of the holder clip and i want it to scroll to the height of the attached entry clips.

Possible?

Thanks again for the help. :slight_smile:

Here is all the code so far:

ActionScript Code:
[FONT=Courier New][LEFT]contentXML = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000FF]XML[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] 

contentXML.[COLOR=#0000FF]ignoreWhite[/COLOR] = [COLOR=#000000]true[/COLOR]
contentXML.[COLOR=#0000FF]load[/COLOR]COLOR=#000000[/COLOR]
contentXML.[COLOR=#000080]ref[/COLOR] = [COLOR=#0000FF]this[/COLOR]

contentXML.[COLOR=#0000FF]onLoad[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] root = [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]firstChild[/COLOR];
[COLOR=#808080]//trace(root);[/COLOR]
entryNodes = root.[COLOR=#0000FF]childNodes[/COLOR];
[COLOR=#808080]//trace(entryNodes);[/COLOR]
[COLOR=#0000FF]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] i=[COLOR=#000080]0[/COLOR]; i<entryNodes.[COLOR=#0000FF]length[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
theDate = entryNodes[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000FF]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]nodeValue[/COLOR];
[COLOR=#808080]//trace(theDate);[/COLOR]
theTitle = entryNodes[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000FF]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]nodeValue[/COLOR];
[COLOR=#808080]//trace(theTitle);[/COLOR]
theDetails = entryNodes[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000FF]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]2[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]nodeValue[/COLOR];
main.[COLOR=#000080]holder[/COLOR].[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“entry_clip”[/COLOR],[COLOR=#FF0000]“entry_mc”[/COLOR]+i, i[COLOR=#000000])[/COLOR];
theEntry_clip = main.[COLOR=#000080]holder[/COLOR][COLOR=#000000][[/COLOR][COLOR=#FF0000]“entry_mc”[/COLOR]+i[COLOR=#000000]][/COLOR];
theEntry_clip.[COLOR=#000080]details_txt[/COLOR].[COLOR=#0000FF]autoSize[/COLOR] = [COLOR=#000000]true[/COLOR];
theEntry_clip.[COLOR=#000080]date_txt[/COLOR].[COLOR=#0000FF]text[/COLOR] = theDate;
theEntry_clip.[COLOR=#000080]details_txt[/COLOR].[COLOR=#0000FF]htmlText[/COLOR] = [COLOR=#FF0000]’<b><u><font size = “12”>’[/COLOR] + theTitle + [COLOR=#FF0000]’</font></u></b><br><br><font size = “10”>’[/COLOR] + theDetails + [COLOR=#FF0000]’</font>’[/COLOR];
theEntry_clip.[COLOR=#000080]border_mc[/COLOR].[COLOR=#0000FF]_y[/COLOR] = theEntry_clip.[COLOR=#000080]details_txt[/COLOR].[COLOR=#0000FF]_height[/COLOR] + theEntry_clip.[COLOR=#000080]details_txt[/COLOR].[COLOR=#0000FF]_y[/COLOR] + [COLOR=#000080]5[/COLOR];
prevEntry = main.[COLOR=#000080]holder[/COLOR][COLOR=#000000][[/COLOR][COLOR=#FF0000]“entry_mc”[/COLOR]+COLOR=#000000[/COLOR][COLOR=#000000]][/COLOR];
theEntry_clip.[COLOR=#0000FF]_y[/COLOR] += prevEntry.[COLOR=#0000FF]_y[/COLOR] + prevEntry.[COLOR=#0000FF]_height[/COLOR] + [COLOR=#000080]5[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“Error loading XML document”[/COLOR][COLOR=#000000])[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

This code is on the main mc that contains the holder and slider and whatnot:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#808080]// Credit for this code goes to Ibad Desmukh aka ibadmd. [/COLOR]
[COLOR=#808080]
// Copyright 2006.
[/COLOR]

scrolling = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] moveSpeed:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]5[/COLOR];
[COLOR=#000000]var[/COLOR] easingSpeed:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]10[/COLOR];
[COLOR=#000000]var[/COLOR] scrollHeight:[COLOR=#0000FF]Number[/COLOR] = sliderbg.[COLOR=#0000FF]_height[/COLOR];
[COLOR=#808080]// amount of scroll[/COLOR]
[COLOR=#000000]var[/COLOR] scrollable:[COLOR=#0000FF]Number[/COLOR] = holder.[COLOR=#0000FF]_height[/COLOR] - maskedView.[COLOR=#0000FF]_height[/COLOR];
[COLOR=#808080]//trace(entryClipHeight);[/COLOR]
[COLOR=#000000]var[/COLOR] initContentPos:[COLOR=#0000FF]Number[/COLOR] = holder.[COLOR=#0000FF]_y[/COLOR];
[COLOR=#808080]// the drag positions that are possible for the slider[/COLOR]
[COLOR=#000000]var[/COLOR] [COLOR=#0000FF]left[/COLOR]:[COLOR=#0000FF]Number[/COLOR] = sliderbg.[COLOR=#0000FF]_x[/COLOR];
[COLOR=#000000]var[/COLOR] top:[COLOR=#0000FF]Number[/COLOR] = sliderbg.[COLOR=#0000FF]_y[/COLOR];
[COLOR=#000000]var[/COLOR] [COLOR=#0000FF]right[/COLOR]:[COLOR=#0000FF]Number[/COLOR] = sliderbg.[COLOR=#0000FF]_x[/COLOR];
[COLOR=#000000]var[/COLOR] bottom:[COLOR=#0000FF]Number[/COLOR] = sliderbg._height-slider.[COLOR=#0000FF]_height[/COLOR]+sliderbg.[COLOR=#0000FF]_y[/COLOR];
[COLOR=#808080]// checking if the content is even scrollable[/COLOR]
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
slider.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]false[/COLOR];
[COLOR=#808080]//sliderbg._alpha = 50;[/COLOR]
[COLOR=#0000FF]return[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]// current position updater [/COLOR]
[COLOR=#000000]function[/COLOR] updateContentPosCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] percent_scrolled:[COLOR=#0000FF]Number[/COLOR] = COLOR=#000000[/COLOR];
[COLOR=#808080]
// instead of setting the _y property directly, we simple set newY
[/COLOR]
[COLOR=#808080]// that way we can adjust how we handle the new Y coordinate we’d like to move to[/COLOR]
holder.[COLOR=#000080]newY[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]// position to move to[/COLOR]
holder.[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]!easing || easing == [COLOR=#0000FF]undefined[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]_y[/COLOR] = [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]newY[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]_y[/COLOR] += [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
slider.[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]startDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]this[/COLOR], [COLOR=#000000]false[/COLOR], [COLOR=#0000FF]left[/COLOR], top, [COLOR=#0000FF]right[/COLOR], bottom[COLOR=#000000])[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onMouseMove[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
updateContentPosCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR];
slider.[COLOR=#0000FF]onMouseUp[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]stopDrag[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000FF]delete[/COLOR] [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onMouseMove[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#808080]// user offset to update[/COLOR]
updateContentPosCOLOR=#000000[/COLOR];
[COLOR=#808080]//checking where the mouse was[/COLOR]
areaJump = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] maxHeight = [COLOR=#000080]120[/COLOR];
[COLOR=#000000]var[/COLOR] [COLOR=#0000FF]mouse[/COLOR] = [COLOR=#0000FF]_ymouse[/COLOR];
[COLOR=#000000]var[/COLOR] maxMouse = [COLOR=#000080]179[/COLOR];
[COLOR=#000000]var[/COLOR] minMouse = [COLOR=#000080]20[/COLOR];
[COLOR=#000000]var[/COLOR] mouseLimits = maxMouse-minMouse;
[COLOR=#000000]var[/COLOR] mousePer = COLOR=#000000[/COLOR]/maxMouse;
[COLOR=#000000]var[/COLOR] posY = mousePermouseLimits;
movesliderCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#808080]
//moving the slider and content*[/COLOR]
[COLOR=#000000]function[/COLOR] movesliderCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
slider.[COLOR=#0000FF]_y[/COLOR] = where;
updateContentPosCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]

sliderbg.[COLOR=#0000FF]onRollOver[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]useHandCursor[/COLOR] = [COLOR=#000000]**false**[/COLOR]

[COLOR=#000000]}[/COLOR]

sliderbg.[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    areaJump[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];

[COLOR=#000000]}[/COLOR];
[COLOR=#808080]// turn easing to true or false[/COLOR]
scrollingCOLOR=#000000[/COLOR];
[COLOR=#808080]// set a dynamic mask[/COLOR]
holder.[COLOR=#0000FF]setMask[/COLOR]COLOR=#000000[/COLOR];
[/LEFT]
[/FONT]