EasyManua.ls Logo

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING - Page 366

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING
1130 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
366 Chapter 12: Methods
• When downloading files from the Internet, use it to download the file at a specific URL and
set the filename of linked media.
Note: To import a file from a URL, it is usually more efficient to use the preloadNetThing() to
download the file to a local disk first, and then import the file from the local disk. Using
preloadNetThing() also minimizes any potential downloading issues.
• Use it to import both RTF and HTML documents into text cast members with formatting and
links intact.
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");