Unlinking external files
In Director several member types can be included in a cast, by linking to an external file. Video files for instance, cannot be fully imported into a cast, they are by defaut a linked member.
Contents
Unlinking Members
The problem is to unlink members like scripts and media, when you want to. Director does unfortunately not offer any option to do so (except when publishing to a projector). If you just try to delete the path (in the property inspector), Director will put the path back in.
But you can unlink members using Lingo. Depending on the member type it gets a little nasty.
(If you have a cast full of linked members, then just write a repeat loop through all members of that cast.)
Unlinking Scripts
You can unlink scripts by the following command:
member("myScript").fileName = 0
This will delete the path to the external file, so that your script is now a normal internal script.
Another option is to use the "linked" property:
member("myScript").linked = false
Unlinking Images
With 32-Bit images you can do the same as with the scripts. Just type:
member("my32BitImage").fileName = 0
But consider that this command will trim the [whitespace] (that means it kills any white border the image might have). A way to circumvent this is using the importFileInto function:
tMember = member("my32BitImage") tMember.importFileInto(tMember.fileName, [#trimwhiteSpace:FALSE])
But importFileInto neither lets you define a palette nor the bitdepth. It just puts in an image, with the same bitdepth as your monitor setting. You could set your screen to a low bitdepth - then importFileInto will use the same for the imported images.
Note that:
member("my32BitImage").fileName = ""
doesn't work !
Unlinking Palette Images
Images with a lesser bitdepth are a bit more complicated.
The better and more predictable way than changing your monitor settings, will be to some more Lingo. You'll have to read all necessary properties from the linked member, and then rebuild a new one. Since you cannot set the bitdepth, you will need dummy images. The following code assumes that there is one 8bit member called "8bit dummy" and a 4bit member called "4bit dummy".
t8bitMem = member("8bit dummy", "graphics general") t4bitMem = member("4bit dummy", "graphics general")
tMember = member("myImage") tBitDepth = tMember.depth
--this checks the bitdepth, because 32 Bit images --would lose the alpha channel if tBitDepth < 32 then tImage = tMember.image.duplicate() tComments = tMember.comments tName = tMember.name tPalette = tMember.paletteRef
if tBitDepth = 8 then t8BitMem.copyToClipBoard() else if tBitDepth = 4 then t4BitMem.copyToClipBoard() else put "unknown bitdepth ("&tBitDepth&") - please look at member:" &&tMember t8BitMem.copyToClipBoard() end if
tMember.pasteClipBoardInto() tMember.paletteRef = tPalette tMember.image = tImage tMember.comments = tComments tMember.name = tName
else tMember.importfileInto(tMember.fileName, [#trimwhitespace:FALSE, #mapImageToStage:FALSE])
end if
This way you will have the same member as before. But please note that some things may not be considered in this code. The location of the regpoint for instance, and settings like trim.
Also the filesizes may vary: Sometimes the unlinked members will be smaller, sometimes bigger. 32bit images, will always be bigger, because the compression is deleted. Depending on your compression settings, they will get compressed when publishing.