Đang chuẩn bị liên kết để tải về tài liệu:
Foundation Flash CS5 For Designers- P16
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Foundation Flash CS5 For Designers- P16: Flash is one of the most engaging, innovative, and versatile technologies available-allowing the creation of anything from animated banners and simple cartoons to Rich Internet Applications, interactive videos, and dynamic user interfaces for web sites, kiosks, devices, or DVDs. The possibilities are endless, and now it just got better | BUILDING STUFF hugging the left edge of SeekBar. As it is however the numbers are easy. To coordinate its movements with SeekBar all SeekKnob has to do is know SeekBar s horizontal position seekBar.x and take into consideration SeekBar s width seekBar.width . To position the knob along the bar s left edge all you need to do set its MovieClip.x property to the bar s MovieClip.x property. To slide it halfway across set the knob s x property to the x property of the bar plus half of the bar s width. To shove it all the way over set its x property to bar s plus the full width of the bar. Keep this principle in mind as we work through the seek slider ActionScript. To begin copy another one of the commented code block headers and paste it below the last bit of ActionScript nextHandler from the Buttons section . Change the header s caption to Seek slider and then type in the following ActionScript so that your code looks like this Seek slider prep seekKnob.buttonMode true events seekKnob.addEventListener MouseEvent.MOUSE_DOWN seekStartDrag Like the Prev Play Pause and Next movie clip buttons the seekKnob instance needs to have its buttonMode property set to true. When the user clicks it you want the user to be able to start dragging that knob so the MouseEvent.MOUSE_DOWN event is associated with a custom function you re about to write called seekStartDrag . That function is triggered when the user clicks the mouse MOUSE_DOWN on the seekKnob instance. Type the following new ActionScript function seekStartDrag evt MouseEvent void if song null pauseSong rect new Rectangle seekBar.x seekKnob.y seekBar.width 0 seekKnob.startDrag true rect stage.addEventListener MouseEvent.MOUSE_UP seekStopDrag If the song instance isn t null for example it s null before a song is chosen from the combo box then pause the song in case it s playing. Next define a Rectangle instance stored in the rect variable which will be used to constrain dragging to the desired location. Rectangle instances .