YOMEDIA
ADSENSE
Understanding and Using fscommand()
48
lượt xem 2
download
lượt xem 2
download
Download
Vui lòng tải xuống để xem tài liệu đầy đủ
Sự hiểu biết và sử dụng fscommand () fscommand () là một chức năng cho phép một bộ phim Flash để giao tiếp với các ứng dụng hiện đang nắm giữ các bộ phim. Sau đây là những ví dụ về các ứng dụng mà giữ (chủ nhà) Flash phim
AMBIENT/
Chủ đề:
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Understanding and Using fscommand()
- < Day Day Up > < Day Day Up > Understanding and Using fscommand() fscommand() is a function that enables a Flash movie to communicate with the application that's currently holding the movie. The following are examples of applications that hold (host) Flash movies: • Standalone Flash player • Web browser • Executable that displays the Flash movie, such as those created by third-party tools discussed later in this lesson; or executables created using C++, Visual Basic, and so on It's simple to use an FSCommand from within Flash. The fscommand() function accepts two parameters: a command name, and optional extra information. The extra information is used as a parameter of the command: fscommand("command_name", "optional extra stuff"); When Flash executes an fscommand(), the host application receives notification that a command has been sent to it. The name of the command is sent, as well as any optional parameter data. The host application must be programmed to deal with these incoming commands; it looks at the name of the incoming command and reacts accordingly, using any optional parameter data to complete the task. This functionality will become clearer as we progress in this lesson.
- < Day Day Up > Let's explore in detail some of the previously mentioned uses of the fscommand() function. Controlling the Standalone Flash Player (Projectors) Using the Publish settings in Flash, you can publish a Flash movie as a projector. A projector file typically contains your movie as well as the Flash player. Opening the file causes your movie to play in its own application window (the Flash player/Projector window). The fscommand() function can be used in your movie so that it can communicate with the projector in various ways. There are six built-in FSCommands that the standalone player can execute: fscommand("quit") This command closes the standalone player window. fscommand("fullscreen", true)
- < Day Day Up > or fscommand("fullscreen", false) This command forces the standalone player to play at full screen (if true) or at the defined movie size (if false). fscommand("allowscale", true) or fscommand("allowscale", false) This command determines what happens if the user resizes the projector window while your movie is playing. If true, the movie is scaled to fit 100% in the resized standalone player window. If false, the player window is still resizable, but the movie playing inside it remains at its original size. fscommand("showmenu", true) or fscommand("showmenu", false) Right-clicking (Control-clicking on a Macintosh) a movie playing in the standalone player opens a context menu. The minimal version of this menu is shown if this
- < Day Day Up > fscommand() parameter is set to false. The full menu is shown if true. fscommand("exec", fileName) This command executes (opens) another application (such as an .EXE file on Windows). The parameter is the filename of the application to open. Applications opened using this command must reside in a folder named fscommand. This folder must reside in the same directory as the projector. fscommand("trapallkeys", true) or fscommand("trapallkeys", false) If true, all key events are sent to the Flash player. If false, certain key events such as accelerator keypresses are not sent. Any of these commands can be executed from within your movie using syntax similar to the following: myButton_btn.onRelease = function(){ fscommand("quit"); } Standalone FSCommands have no effect on Flash movies played outside the stand alone
- < Day Day Up > player. Executing Applescripts with Fscommands AppleScript is a built-in scripting language for the Macintosh operating system. AppleScripts (files containing AppleScript code) are used to tell the operating system to perform tasks such as these: • Batch processing • File conversion and manipulation • Performing tasks at specified times One of the more powerful aspects of using the exec FSCommand in a Macintosh-based projector is its capability to execute an AppleScript. Let's look at a simple example. NOTE This is not intended to be extensive instruction on how to create AppleScripts, but rather a simple demonstration of how AppleScripts can be executed via Flash. For more information on AppleScript, visit http://www.apple.com/applescript/. The following AppleScript opens the file named catalog.pdf on the My CD disk: tell application "Finder" activate select file "catalog.pdf" of disk "My CD" open selection end tell To execute this AppleScript from Flash, you name it (for example, launchCatalog), save it in the fscommand folder, and create a script within your Flash movie similar to the following: myButton_btn.onRelease = function(){
- < Day Day Up > fscommand("exec", "launchCatalog"); } When myButton_btn is clicked, the launchCatalog AppleScript is executed, and catalog.pdf opens. Communicating with a Web Browser When a Flash movie is embedded in an HTML page and the page is viewed in a Web browser, the fscommand() function enables the Flash movie to communicate with the browser via JavaScript. This feature allows you to do tasks such as open alert boxes, resize the browser, and other JavaScript activities. NOTE Because the success of this communication depends on the specific browser and version, some Flash developers limit their use of the fscommand() function. For more information about using the FSCommand to communicate with a browser, visit www.macromedia.com. Creating an Enhanced Executable (Projector) Several companies make software to extend the functionality of a Flash movie. Most of these products take an SWF file and wrap it within a powerful executable shell. This shell can be considered a high-tech "box" that contains your SWF. The box has been programmed with the capability to perform all sorts of tasks that a typical SWF can't do. The SWF controls this powerful box by sending specialized FSCommands to it. Think of the SWF as the interface and brains of the resulting application, and the box (executable) as the facilitator. These are a few of the most popular products that extend Flash: • Flash Studio Pro— Multidmedia (MDM) Limited (www.multidmedia.com) • SWF Studio— Northcode (www.northcode.com) • Screenweaver— Rubberduck (www.screenweaver.com)
- < Day Day Up > NOTE At this time, no software exists to create enhanced standalone Flash movies for non- Windows operating systems. These applications extend Flash's capabilities with hundreds of commands. Typically, you open the application (such as Flash Studio Pro), locate the SWF file that makes use of special FSCommands, adjust a few settings, and click the GO button, which creates an .EXE file. When opened, this file contains and plays your SWF movie, and is sent commands by your movie. The end result is a powerful Flash movie. NOTE Flash Studio Pro and SWF Studio extend Flash by means of FSCommands; Screenweaver takes an approach that's more similar to typical ActionScript syntax. The following are a few of the tasks that can be accomplished with FSCommands
- < Day Day Up > through the use of a third-party tool: • Create or remove text files or directories • Upload and download files from the Internet • FTP files from the Internet • Force the computer to display the Flash content in DirectX mode • Open a file browse pop-up window to allow a user to locate a file or location • Save a screenshot of the Flash content or a specific area within the Flash content • Set the desktop wallpaper on the user's computer Although most of the extended functionality that you gain from these software products comes from executing FSCommands, several configurable options can be set directly from the software's interface (to be applied to the executable file that's created): • Disable right-click • Remove window borders • Make the window always run on top of all other windows • Assign a custom icon to the executable • Include additional files in the executable < Day Day Up >
ADSENSE
CÓ THỂ BẠN MUỐN DOWNLOAD
Thêm tài liệu vào bộ sưu tập có sẵn:
Báo xấu
LAVA
AANETWORK
TRỢ GIÚP
HỖ TRỢ KHÁCH HÀNG
Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn