Documentation correction for importFileInto
IssueThe documentation for the command importFileInto, was not updated correctly in the Director MX Lingo Dictionary. This TechNote provides the updated information for this command.
Documentation correction
importFileInto
Syntax
importFileInto member myMember, fileName{, [#dither:True/False, #trimWhiteSpace:True/False]} importFileInto member myMember of castLib whichCast, fileName {,[#dither:True/False,#trimWhiteSpace:True/False]} importFileInto member myMember,URL {,[#dither:True/False, #trimWhiteSpace:True/False]}
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 theimportFileInto 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:
| 1. | 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. |
| 2. | When generating the Score from Lingo during movie creation, use it to assign content to new cast members that you created. |
| 3. | 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.) |
| 4. | 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")
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
