Danh mục

The Ins and Outs of Loading External Assets

Số trang: 3      Loại file: pdf      Dung lượng: 20.26 KB      Lượt xem: 1      Lượt tải: 0    
thaipvcb

Hỗ trợ phí lưu trữ khi tải xuống: 1,000 VND Tải xuống file đầy đủ (3 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Các Ins Và ngoài của Loading Tài sản ngoài Khi bạn tải các tài sản bên ngoài thành một bộ phim, bạn đang tải một file media (như một tập tin MP3, một JPG đồ họa, video, hay ngay cả một SWF) vào một bộ phim Flash vì nó đóng vai . Nói cách khác, bạn đang thêm tài sản cho bộ phim của bạn.
Nội dung trích xuất từ tài liệu:
The Ins and Outs of Loading External Assets < Day Day Up >The Ins and Outs of Loading External AssetsWhen you load external assets into a movie, youre loading a media file (such as an MP3file, a JPG graphic, a video, or even another SWF) into a Flash movie as it plays. In otherwords, youre adding assets to your movie. In fact, you can create a Flash movie thatcontains nothing but script set up to load text, animations, graphics, and sounds fromexternal assets. Media thats loaded dynamically in this fashion can exist on a Web serveror on a disk or CD if your project is distributed as a projector; therefore, a single projectcan load media from several sources simultaneously. All thats usually required is thedirectory path to the files. Its that simple! No special server technologies required.Sometimes, as is the case when loading media files from a disk or CD, not even a serveris needed.By loading external assets (rather than placing all of your projects media in a singleSWF), your project benefits in a number of ways: • Your movie downloads faster over the Web. Imagine that you have a site containing four sections—Home, Services, Products, and Contact—each of which has its own graphic and soundtrack. Together, the graphic and soundtrack add 100 KB to each section—a total of 400 KB if you place everything in a single SWF. For users connecting via 56 Kbps modems, your site will take nearly two minutes to download—a sure way to turn viewers away. Youre better off loading each sections graphic/soundtrack on an as-needed basis, or only when a user navigates to that section—the approach that most HTML-based sites take. • You can view multiple movies in the player window without navigating to different HTML pages. When using a browser to navigate Web sites, you dont need to close one window and then open another just to move from page to page. Instead, the browser remains open while the windows content changes as pages are loaded and unloaded. The same thing happens when external movies are loaded into Flashs player window: The player window simply acts as a container whose contents (a Flash movie) change without the user having to close the movie window or navigate to a different HTML page. • Your project becomes modular—and thus easy to update and reuse. When you begin using assets loaded from external sources in your project, Flash movies become nothing more than interactive modules that you can load (plug into) your project at will. Any revisions to a particular module will appear automatically in any other project that contains it. Think again of a standard Web site: Even though each graphic (for example, a logo) usually resides in a single location on the server, multiple pages can contain that logo simply by referencing its directory path on the server—so you dont need to create a separate logo graphic for each page. You can reuse that graphic on any number of pages, and all of the pages on which it appears will reflect those changes anytime you update that graphic. The same holds true for externally loaded content in your Flash projects—a benefit that cannot be overemphasized because its much easier to individually edit several smaller, externally loaded files than to open a complex project with numerous scenes, layers, tweens, movie clip instances, and scripting every time you need to make a change. • Your project becomes more dynamic, offering each user a unique experience. By loading external assets, you can provide the user with a much more dynamic experience, employing a wider range of content that loads based on time of day, month, user input, or even a randomly generated number.Although it would be next to impossible to create a single SWF that could displayappropriate content based on so many variables, using externally loaded assets makes thistype of dynamic functionality a breeze.You can load external assets by using loadMovie() or loadMovieNum() for external SWFor JPG files, or loadSound() for external MP3s. Video assets can be loaded using aninstance of the netStream() class; however, the Media components provide a much easierinterface for getting video (and MP3) content into your project, as well discuss later inthis lesson.In the following exercises, youll learn how to load a variety of external file types, andhow to control these assets using ActionScript. < Day Day Up >

Tài liệu được xem nhiều: