Im loading in some images (all with 50px in height), with various widths.
I have an animation over the images in a MC called “over”.
the MC over lies within thumbMC wich again lies within a MC called containerMC.
ThumbMC is generated as many times as I have images (via XML)
The image loaded in gets loaded in “loader” which lies within thumbMC aswell.
Id like “over” MC to be the width of the loaded image.
heres the AS for the scroller I have all the thumb images scrolling in:
ActionScript Code:
[FONT=Courier New][LEFT]</p>
<p>MovieClip.[COLOR=#0000ff]prototype[/COLOR].[COLOR=#000080]easeX[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_x[/COLOR] = x-COLOR=#000000[/COLOR]/[COLOR=#000080]1[/COLOR].[COLOR=#000080]2[/COLOR];</p>
<p> [COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]delete[/COLOR] [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR];</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_x[/COLOR] = x;</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p> [COLOR=#000000]}[/COLOR];</p>
<p>[COLOR=#000000]}[/COLOR];</p>
<p>images = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]Array[/COLOR]COLOR=#000000[/COLOR];</p>
<p>xml_file = [COLOR=#ff0000]“images2.xml”[/COLOR];</p>
<p>xmlload = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]XML[/COLOR]COLOR=#000000[/COLOR];</p>
<p>xmlload.[COLOR=#0000ff]ignoreWhite[/COLOR] = [COLOR=#000000]true[/COLOR];</p>
<p>xmlload.[COLOR=#0000ff]onLoad[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> count = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]childNodes[/COLOR].[COLOR=#0000ff]length[/COLOR];</p>
<p> [COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] i = [COLOR=#000080]0[/COLOR]; i<count; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> curNode = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR];</p>
<p> images[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR] = [COLOR=#000000]{[/COLOR]path:curNode.[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR],link:curNode.[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR],[COLOR=#0000ff]caption[/COLOR]:curNode.[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]2[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR][COLOR=#000000]}[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p> bootCOLOR=#000000[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR] [COLOR=#0000ff]else[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“Could not load “[/COLOR]+xml_file+[COLOR=#ff0000]”.”[/COLOR][COLOR=#000000])[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p>[COLOR=#000000]}[/COLOR];</p>
<p>xmlload.[COLOR=#0000ff]load[/COLOR]COLOR=#000000[/COLOR];</p>
<p>[COLOR=#808080]// ------------------------------------------------------------</p>[/COLOR]
<p>spacing = [COLOR=#000080]5[/COLOR];</p>
<p>boot = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] i = [COLOR=#000080]0[/COLOR]; i<images.[COLOR=#0000ff]length[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> mc = container.[COLOR=#0000ff]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“thumbMC”[/COLOR], [COLOR=#ff0000]“thumb”[/COLOR]+i, i[COLOR=#000000])[/COLOR];</p>
<p>[COLOR=#808080]//the 120 is what Id like done dynamically</p>[/COLOR]
<p> mc.[COLOR=#0000ff]_x[/COLOR] = i*COLOR=#000000[/COLOR];</p>
<p> mc.[COLOR=#000080]path[/COLOR] = images[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000080]path[/COLOR];</p>
<p> mc.[COLOR=#000080]link[/COLOR] = images[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000080]link[/COLOR];</p>
<p> mc.[COLOR=#000080]over[/COLOR].[COLOR=#000080]captionMC[/COLOR].[COLOR=#0000ff]caption[/COLOR].[COLOR=#0000ff]text[/COLOR] = images[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000ff]caption[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p> setRollOverCOLOR=#000000[/COLOR];</p>
<p>[COLOR=#000000]}[/COLOR];</p>
<p>setRollOver = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#000080]mask[/COLOR].[COLOR=#0000ff]hitTest[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#0000ff]_xmouse[/COLOR], [COLOR=#0000ff]_root[/COLOR].[COLOR=#0000ff]_ymouse[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> slideMenuCOLOR=#000000[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p> [COLOR=#000000]}[/COLOR];</p>
<p>[COLOR=#000000]}[/COLOR];</p>
<p>slideMenu = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> diff = _xmouse-[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_x[/COLOR];</p>
<p> scale = diff*[COLOR=#000080]100[/COLOR]/[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]mask[/COLOR].[COLOR=#0000ff]_width[/COLOR];</p>
<p> [COLOR=#0000ff]target[/COLOR] = -scale*COLOR=#000000[/COLOR]/[COLOR=#000080]100[/COLOR];</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]arrows[/COLOR].[COLOR=#000080]easeX[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]container[/COLOR].[COLOR=#000080]easeX[/COLOR]COLOR=#000000[/COLOR];</p>
<p>[COLOR=#000000]}[/COLOR];</p>
<p>
[/LEFT]
[/FONT]
and here is the code that lies within the thumbMC MC:
ActionScript Code:
[FONT=Courier New][LEFT]</p>
<p>MovieClip.[COLOR=#0000ff]prototype[/COLOR].[COLOR=#000080]backwards[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]prevFrame[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_currentframe[/COLOR] == [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#0000ff]delete[/COLOR] [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p>[COLOR=#000000]}[/COLOR]</p>
<p>loader.[COLOR=#0000ff]loadMovie[/COLOR]COLOR=#000000[/COLOR];</p>
<p>percent = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR]COLOR=#000000[/COLOR];</p>
<p>percentage.[COLOR=#0000ff]text[/COLOR] = percent;</p>
<p>aux.[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]if[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]delete[/COLOR] [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR];</p>
<p> loader.[COLOR=#0000ff]onRollOver[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]delete[/COLOR] over.[COLOR=#0000ff]onEnterFrame[/COLOR];</p>
<p> over.[COLOR=#0000ff]play[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p> loader.[COLOR=#0000ff]onRollOut[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]</p>
<p> over.[COLOR=#000080]backwards[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p> loader.[COLOR=#0000ff]onRelease[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#0000ff]getURL[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_parent[/COLOR].[COLOR=#000080]link[/COLOR], [COLOR=#ff0000]"_blank"[/COLOR][COLOR=#000000])[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR];</p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p>[COLOR=#000000]}[/COLOR];</p>
<p>
[/LEFT]
[/FONT]
Thanks so much in advance
pxa