importFileInto()

Usage

-- Lingo syntax
memberObjRef.importFileInto(fileOrUrlString)

// JavaScript syntax
memberObjRef.importFileInto(fileOrUrlString);

Description

Member method; replaces the content of a specified cast member with a specified file.

The importFileInto() method is useful in the following situations.

Using importFileInto() in projectors can quickly consume available memory, so reuse the same members for imported data when possible.

In Director and projectors, importFileInto() automatically downloads the file. In Shockwave Player, call preloadNetThing() and wait for a successful completion of the download before using importFileInto() with the file.

Parameters

fileOrUrlString Required. A string that specifies the file that will replace the content of the cast member.

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:

-- Lingo syntax
on exitFrame
   tempURL = "http://www.dukeOfUrl.com/crown.gif"
   _movie.newMember(#bitmap).importFileInto(tempURL)
end

// JavaScript syntax
function exitFrame() {
   var tempURL = "http://www.dukeOfUrl.com/crown.gif";
   _movie.newMember("bitmap").importFileInto(tempURL);
}

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

-- Lingo syntax
member("Memory").importFileInto("Wind.wav")

// JavaScript syntax
member("Memory").importFileInto("Wind.wav");

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:

-- Lingo syntax
downLoadNetThing("http://www.cbDeMille.com/Talkies.AIF", \
_player.applicationPath & "Talkies.AIF") member("Norma Desmond Speaks").importFileInto(_player.applicationPath & "Talkies.AIF") // JavaScript syntax downLoadNetThing("http://www.cbDeMille.com/Talkies.AIF",
_player.applicationPath + "Talkies.AIF"); member("Norma Desmond Speaks").importFileInto(_player.applicationPath +
"Talkies.AIF");

See also

downloadNetThing, fileName (Window), Member, preloadNetThing()