[SIZE=1]Hello:
I have a movie clip containing thumbnails. When you click on a thumbnail it loads the full-size image into a container in a 2nd movie clip called itemdetails_mc and resizes and recenters it to fit in the container. A watermark MC is displayed at the bottom of the resized image, scaled to the same width as the resized image while maintaining aspect ratio.
Both the thumbnails MC and the itemdetails_mc are on the main Timeline.
I set the display of itemdetails_mc to the onRelease function of itemdetails_btn:
(thumbnail clip).itemdetails_btn.onRelease = ShowItemDetails;
The ShowItemDetails function is defined as follows:[/SIZE]
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]**function**[/COLOR] ShowItemDetails[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
itemdetails_mc.[COLOR=#0000ff]visible[/COLOR] = [COLOR=#000000]**true**[/COLOR]; [COLOR=#808080]*//set to "false" at beginning*[/COLOR]
[COLOR=#000000]**var**[/COLOR] detailthumb = [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]filepath_text[/COLOR];
itemdetails_mc.[COLOR=#000080]detailthumb_mc[/COLOR].[COLOR=#0000ff]loadMovie[/COLOR][COLOR=#000000]([/COLOR]detailthumb[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]
[SIZE=1]The first time the ShowItemDetails function is called:
The full-size image is recentered and resized properly and the watermark is properly displayed.
Each successive time the function is called, while itemdetails_mc is visible:
Clicking on a thumbnail resizes the new loaded full-size image properly but doesn’t process the code to recenter: it just uses the same x and _y coords as the first recentered image. The dimensions and coords of the watermark are also the same as the first.
My resize/recenter code:[/SIZE]
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#808080]//after full size image loads into detailthumb_mc,[/COLOR]
[COLOR=#808080]//resize image so that neither width nor height is > 150, tben recenter[/COLOR]
[COLOR=#0000ff]onClipEvent[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] maxWidth = [COLOR=#000080]150[/COLOR];
[COLOR=#000000]var[/COLOR] maxHeight = [COLOR=#000080]150[/COLOR];
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR] > maxWidth || [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR] > maxHeight[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] scaleFactor = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR] > [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR] ? maxWidth / [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR] : maxHeight / [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR] = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR] * scaleFactor[COLOR=#000000])[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR] = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR] * scaleFactor[COLOR=#000000])[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_x[/COLOR] = [COLOR=#000080]85[/COLOR] - COLOR=#000000[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_y[/COLOR] = [COLOR=#000080]90[/COLOR] - COLOR=#000000[/COLOR];
[COLOR=#808080]//display gallerywm_mc at bottom of resized image[/COLOR]
[COLOR=#000000]var[/COLOR] gallerywm = [COLOR=#0000ff]_parent[/COLOR].[COLOR=#000080]gallerywm_mc[/COLOR];
gallerywm.[COLOR=#0000ff]_x[/COLOR] = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_x[/COLOR];
gallerywm.[COLOR=#0000ff]_y[/COLOR] = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_y[/COLOR] + [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR] - [COLOR=#000080]20[/COLOR];
gallerywm.[COLOR=#0000ff]_width[/COLOR] = [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR];
gallerywm.[COLOR=#0000ff]_height[/COLOR] = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR] [COLOR=#000000]([/COLOR]gallerywm.[COLOR=#0000ff]_height[/COLOR] * [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_width[/COLOR] /[COLOR=#000080]150[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#808080]//hide boundingbox_mc if image is portrait orientation[/COLOR]
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_height[/COLOR] == [COLOR=#000080]150[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]_parent[/COLOR].[COLOR=#000080]boundingbox_mc[/COLOR].[COLOR=#0000ff]_visible[/COLOR]= [COLOR=#000000]false[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]//hide imagepreloader_mc[/COLOR]
[COLOR=#0000ff]_parent[/COLOR].[COLOR=#000080]imagepreload_mc[/COLOR].[COLOR=#0000ff]_visible[/COLOR]= [COLOR=#000000]false[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]
[SIZE=1]OPTIONS:
- “Reset” or “refresh” the function so it’s like the first time each time you click on a thumbnail?
- Modify the resize/recenter code so it resets the variables each time?
I want to keep the itemdetails_mc open while switching to another thumbnail.
Thanks.[/SIZE]