tailieunhanh - adobe press ActionScript 3.0 for ADOBE FLASH PROFESSIONAL CS5 Classroom in a Book phần 6

Lưu ý: Một tuyên bố chuyển đổi là một loại thay thế tuyên bố có điều kiện làm việc tương tự như một tuyên bố nếu, nhưng rất nhiều các nhà phát triển muốn sử dụng nó khi có nhiều điều kiện để được kiểm tra. Một tuyên bố chuyển đổi bắt đầu với việc chuyển đổi từ khóa theo sau là các điều kiện để được kiểm tra. Một loạt các báo cáo trường hợp đánh giá mỗi giá trị mà bạn muốn kiểm tra | Note A switch statement is an alternative type of conditional statement that works very similarly to an if statement but lots of developers prefer to use it when there are many conditions to be checked. A switch statement begins with the keyword switch followed by the condition to be checked. A series of case statements evaluates each value that you wish to check. If a case statement is ended with a break then the entire switch statement is ended when one of the case statements is true otherwise the player proceeds through the entire statement. For more information about switch statements see the ActionScript Reference for the Flash Platform. song was selected and set the currSong variable to contain a string that describes the path to that song. For example when the first song in the songList array is selected songList 0 then the currSong variable will be set to . MP3s songList 0 as String The string . MP3s refers to the folder in which songs are stored. The two dots and initial forward slash . tell that the MP3s folder is found in the parent folder of the current Flash file. 1 Add the full switch statement to the chooseSong function so that the entire function reads function chooseSong e MouseEvent void switch case song1 currSong break . MP3s songLi st 0 as Stri ng case song2 currSong break . MP3s songLi st 1 as Stri ng case song3 currSong break . MP3s songLi st 2 as Stri ng case song4 currSong break . MP3s songLi st 3 as Stri ng case song5 currSong break . MP3s songLi st 4 as Stri ng case song6 currSong break . MP3s songLi st 5 as Stri ng Now the currSong variable will store any song the user selects. You will now create and work with three instances. The variable you created called snd will be an instance of the Sound class the variable called channel will be a SoundChannel instance that will contain the snd instance and the trans instance will refer to the SoundTransform object you will create to manipulate the volume and pan of snd.

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.