Lingo Dictionary > G-K > importFileInto |  |

importFileInto

Syntax

    importFileInto member whichCastMember, fileName {, [#dither: TrueOrFalse, #trimWhiteSpace: TrueOrFalse]}
    importFileInto member whichCastMember of castLib whichCast, fileName {, [#dither: TrueOrFalse, #trimWhiteSpace: TrueOrFalse]}
    importFileInto member whichCastMember, URL {, [#dither: TrueOrFalse, #trimWhiteSpace: TrueOrFalse]}

Description

Command; replaces the content of the cast member specified by `whichCastMember` with the file specified by `fileName`.

When importing bitmaps, two optional properties can be included with the `importFileInto` command by passing them as a property list with the command.

When `#dither` set to `TRUE`, the image is dithered to the closest colors of the current palette, rather than remapped to the current palette. The default is `FALSE`.

When `#trimWhiteSpace` is set to `FALSE`, any white pixels surrounding the non-white content of the image will be left intact. When `#trimWhiteSpace` is TRUE, white pixels surrounding the non-white image content are removed. The default is `TRUE`.

These properties can be used individually or in combination.

The `importFileInto` command is useful in four situations:

| When finishing developing a movie, use it to embed media that you have kept linked and external so it can be edited during the project.
| When generating Score from Lingo during movie creation, use it to assign content to new cast members that you created.
| When downloading files from the Internet, use it to download the file at a specific URL and set the file name of linked media. (However, to import a file from a URL, it's usually more efficient and minimizes downloading to use the `preloadNetThing` command to download the file to a local disk first and then import the file from the local disk.)
| Use it to import both RTF and HTML documents into text cast members with formatting and links intact.

Use of the `importFileInto` command`` in projectors can quickly consume available memory, so it's best to reuse the same members for imported data if possible.

Also, the `importFileInto` command doesn't work with the Director player for Java. To change the content of a bitmap or sound cast member in a movie playing back as an applet, make the cast members linked cast members and change the cast member's `fileName` property.

Note: In Shockwave, you must issue a `preloadNetThing` and wait for a successful completion of the download before using importFileInto with the file. In Director and projectors, `importFileInto` automatically downloads the file for you.

Example

This handler assigns a URL that contains a GIF file to the variable `tempURL` and then uses the `importFileInto` command to import the file at the URL into a new bitmap cast member:

    on exitFrame
    	 tempURL = "http://www.dukeOfUrl.com/crown.gif"
    	importFileInto new(#bitmap), tempUrl
    end

Example

This statement replaces the content of the sound cast member Memory with the sound file Wind:

    importFileInto member "Memory", "Wind.wav"

Example

These statements download an external file from a URL to the Director application folder and then import that file into the sound cast member Norma Desmond Speaks:

    downLoadNetThing http://www.cbDeMille.com/Talkies.AIF, the \ applicationPath&"Talkies.AIF" \
    importFileInto(member "Norma Desmond Speaks", the applicationPath&"Talkies.AIF")

See also

`downloadNetThing`, `fileName (cast member property)`, `preloadNetThing()`