Pulling a window to front

I have the following script that is used in conjunction with a flash animation to open a folder. The script simply takes the name of the folder to be opened from the filename, thus making it easy to duplicate the script for opening many folders. Not having a clue about Applescript I have been spending some time trying to work out how to get the ‘open targetFile’ to also bring the window to the front.

I have tried:

tell application “Finder”
open targetFile
activate
end tell
but that just hides all the other windows including the flash presentation.

All I want is for the finder window to open up as the front window.

many thanks for any advice.

here is the script.

–set the path to prepend to the target filename
property targetPath : “Audio:AudioFolder__668:”

–get my path
set myPath to (path to me as string)

–set the delimiter for each path segment
set AppleScript’s text item delimiters to “:”

–retrieve only my filename
set theFileName to text item -1 of myPath as string

–remove the extension portion of my filename
set theFolderName to text 1 thru ((offset of “.” in theFileName) - 1) of theFileName

–set the path to my parent folder
set the parentFolder to ¬
((text items 1 thru -3 of myPath) & “”) as string

set AppleScript’s text item delimiters to “”
– find the target file
try
set targetFile to alias (the parentFolder & targetPath & theFolderName)
on error
–ie if there’s no file here by this name, it will quit.
return quit
end try

tell application “Finder”
open targetFile
end tell