attachMovie help

Hi Guys,

I need some help with the logic for an event handler function I’m trying to write. Basically its an onPress event handler on a movie clip that attaches another movie to it when pressed.The problem is, I only want the movie clip to be attached once in the designated x,y coordinates, no matter how many times the main object is pressed. I’m essentially trying to write my own FreeTransform script, that allows users to resize the object. However, I haven’t got too far, as you may well see, lol.

Below is the my source code:

ActionScript Code:
[FONT=Courier New][LEFT]chair_mc.[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]**var**[/COLOR] bounds:[COLOR=#0000FF]Object[/COLOR] = chair_mc.[COLOR=#0000FF]getBounds[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]this[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#808080]*//*[/COLOR]

[COLOR=#000000]**var**[/COLOR] xpos = bounds.[COLOR=#000080]xMax[/COLOR];            [COLOR=#808080]*// x ordinate of edit point*[/COLOR]
[COLOR=#000000]**var**[/COLOR] ypos = bounds.[COLOR=#000080]yMin[/COLOR]-[COLOR=#000080]10[/COLOR];    [COLOR=#808080]*// y ordinate of edit point*[/COLOR]

[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"editMC"[/COLOR], [COLOR=#FF0000]"edit_mc"[/COLOR], 
    [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]getNextHighestDepth[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR], [COLOR=#000000]{[/COLOR][COLOR=#0000FF]_x[/COLOR]:xpos, [COLOR=#0000FF]_y[/COLOR]:ypos[COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

Please find attached a copy of the .Fla file

Many thanks

TAJ