Chapter 20 Dynamic HTML: Path, Sequencer and Sprite ActiveX ...
Chapter 20 Dynamic HTML: Path, Sequencer and Sprite ActiveX ...
Chapter 20 Dynamic HTML: Path, Sequencer and Sprite ActiveX ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
iw3htp_<strong>20</strong>.fm Page 645 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 645<br />
<strong>20</strong><br />
<strong>Dynamic</strong> <strong>HTML</strong>:<br />
<strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls<br />
1 <br />
2 <br />
3<br />
4 <br />
5 <br />
6<br />
7 <br />
8 <strong>Path</strong> control<br />
9 <br />
10<br />
11 <br />
12<br />
13 <br />
14 <strong>Path</strong> animation:<br />
15<br />
16 <br />
18 <br />
19 <br />
<strong>20</strong> <br />
21 <br />
22 <br />
24 <br />
25 <br />
26<br />
27 <br />
28 <br />
Fig. <strong>20</strong>.1 Demonstrating the DirectAnimation <strong>Path</strong> Control .<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 646 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
646 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
1 <br />
2 <br />
3<br />
4 <br />
5 <br />
6 <br />
7 <strong>Path</strong> Control - Multiple paths<br />
8<br />
9 <br />
10<br />
11 SPAN { position: absolute;<br />
12 font-family: sans-serif;<br />
13 font-size: 2em;<br />
14 font-weight: bold;<br />
15 filter: shadow( direction = 225 );<br />
16 padding: 9px;<br />
17 }<br />
18<br />
19 <br />
<strong>20</strong> <br />
21<br />
22 <br />
23<br />
24 <br />
26<br />
27 <br />
29 Multimedia Cyber Classroom<br />
30 Programming Tip Icons<br />
31<br />
32 <br />
34 Common Programming Errors<br />
35<br />
36 <br />
38 Good Programming Practices<br />
39<br />
40 <br />
42 Performance Tips<br />
43<br />
44 <br />
46 Portability Tips<br />
47<br />
48 <br />
50 Software Engineering Observations<br />
51<br />
52 <br />
Fig. <strong>20</strong>.2 Controlling multiple elements with the <strong>Path</strong> Control (part 1 of 4).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 647 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 647<br />
54 Testing <strong>and</strong> Debugging Tips<br />
55<br />
56 <br />
58 <br />
59 <br />
60 <br />
62 <br />
63 <br />
64<br />
65 <br />
67 <br />
68 <br />
69 <br />
71 <br />
72 <br />
73<br />
74 <br />
76 <br />
77 <br />
78 <br />
80 <br />
81 <br />
82<br />
83 <br />
85 <br />
86 <br />
87 <br />
89 <br />
90 <br />
91<br />
92 <br />
94 <br />
95 <br />
96 <br />
98 <br />
99 <br />
100<br />
101 <br />
103 <br />
104 <br />
105 <br />
107 <br />
Fig. <strong>20</strong>.2 Controlling multiple elements with the <strong>Path</strong> Control (part 2 of 4).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 648 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
648 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
108 <br />
109<br />
110 <br />
112 <br />
113 <br />
114 <br />
116 <br />
117 <br />
118 <br />
119 <br />
Fig. <strong>20</strong>.2 Controlling multiple elements with the <strong>Path</strong> Control (part 3 of 4).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 649 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 649<br />
Fig. <strong>20</strong>.2 Controlling multiple elements with the <strong>Path</strong> Control (part 4 of 4).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 650 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
650 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
1 <br />
2 <br />
3<br />
4 <br />
5 <br />
6<br />
7 <br />
8 <strong>Path</strong> control - Advanced <strong>Path</strong>s<br />
9<br />
10 <br />
12<br />
13 if ( marker == "mark1" )<br />
14 pole.style.zIndex += 2;<br />
15<br />
16 if ( marker == "mark2" )<br />
17 pole.style.zIndex -= 2;<br />
18 <br />
19 <br />
<strong>20</strong><br />
21 <br />
22<br />
23 <br />
25<br />
26 <br />
28<br />
29 <br />
31 <br />
32 <br />
33 <br />
34 <br />
35 <br />
36 <br />
37 <br />
38 <br />
39 <br />
40<br />
41 <br />
43 <br />
44 <br />
45 <br />
46 <br />
47 <br />
50 <br />
Fig. <strong>20</strong>.3 Adding time markers for script interaction (part 1 of 2).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 651 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 651<br />
51 <br />
52<br />
53 <br />
55<br />
56 <br />
58 <br />
60 <br />
62 <br />
64 <br />
66 <br />
68 <br />
70<br />
71 <br />
72 <br />
73 <br />
Fig. <strong>20</strong>.3 Adding time markers for script interaction (part 2 of 2).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 652 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
652 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
1 <br />
2 <br />
3<br />
4 <br />
5 <br />
6<br />
7 <br />
8<br />
9 <br />
10<br />
11 DIV { font-size: 2em;<br />
12 color: white;<br />
13 font-weight: bold }<br />
14<br />
15 <br />
16<br />
17 <br />
18 sequencer.Item( "showThem" ).at( 2.0, "show( line1 )" );<br />
19 sequencer.Item( "showThem" ).at( 4.0, "show( line2 )" );<br />
<strong>20</strong> sequencer.Item( "showThem" ).at( 6.0, "show( line3 )" );<br />
21 sequencer.Item( "showThem" ).at( 7.0, "show( line4 )" );<br />
22 sequencer.Item( "showThem" ).at( 8.0, "run<strong>Path</strong>()" );<br />
23 <br />
24<br />
25 <br />
26 function show( object )<br />
27 {<br />
28 object.style.visibility = "visible";<br />
29 }<br />
30<br />
31 function start()<br />
32 {<br />
33 sequencer.Item( "showThem" ).Play();<br />
34 }<br />
35<br />
36 function run<strong>Path</strong>()<br />
37 {<br />
38 pathControl.Play();<br />
39 }<br />
40 <br />
41 <br />
42<br />
43 <br />
44<br />
45 <strong>Sequencer</strong> DirectAnimation<br />
47<br />
48 <strong>ActiveX</strong> Control<br />
50<br />
51 Controls time intervals<br />
Fig. <strong>20</strong>.4 Using the DirectAnimation <strong>Sequencer</strong> Control (part 1 of 3).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 653 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 653<br />
53<br />
54 For dynamic effects<br />
56<br />
57 <br />
59 <br />
60<br />
61 <br />
63 <br />
64 <br />
65 <br />
66 <br />
67 <br />
68 <br />
69 <br />
70<br />
71 <br />
72 <br />
Fig. <strong>20</strong>.4 Using the DirectAnimation <strong>Sequencer</strong> Control (part 2 of 3).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 654 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
654 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
Fig. <strong>20</strong>.4 Using the DirectAnimation <strong>Sequencer</strong> Control (part 3 of 3).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 655 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 655<br />
Fig. <strong>20</strong>.5<br />
Source image for <strong>Sprite</strong> Control (walking.gif).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 656 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
656 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
1 <br />
2 <br />
3<br />
4 <br />
5 <br />
6<br />
7 <br />
8 <strong>Sprite</strong> Control<br />
9 <br />
10<br />
11 <br />
12<br />
13 <br />
15 <br />
16 <br />
17 <br />
18 <br />
19 <br />
<strong>20</strong> <br />
21 <br />
22<br />
23 <br />
24 <br />
Fig. <strong>20</strong>.6 Simple animation with the <strong>Sprite</strong> Control .<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 657 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 657<br />
1 <br />
2 <br />
3<br />
4 <br />
5 <br />
6<br />
7 <br />
8 <strong>Sprite</strong> Control<br />
9<br />
10 <br />
12<br />
13 bounce.Stop();<br />
14 bounce.PlayRate = -3;<br />
15 bounce.Play();<br />
16 <br />
17<br />
18 <br />
<strong>20</strong><br />
21 bounce.Stop();<br />
22 bounce.PlayRate = 1;<br />
23 bounce.Play();<br />
24 <br />
25 <br />
26<br />
27 <br />
28<br />
29 <strong>Sprite</strong> Control<br />
30<br />
31 <br />
33 <br />
34 <br />
35 <br />
36 <br />
37 <br />
38 <br />
39 <br />
40 <br />
41 <br />
42<br />
43 <br />
44 <br />
Fig. <strong>20</strong>.7 Responding to mouse events with the <strong>Sprite</strong> Control (part 1 of 2).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 658 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
658 <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls <strong>Chapter</strong> <strong>20</strong><br />
Fig. <strong>20</strong>.7 Responding to mouse events with the <strong>Sprite</strong> Control (part 2 of 2).<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.
iw3htp_<strong>20</strong>.fm Page 659 Friday, May 5, <strong>20</strong>00 6:09 PM<br />
<strong>Chapter</strong> <strong>20</strong> <strong>Dynamic</strong> <strong>HTML</strong>: <strong>Path</strong>, <strong>Sequencer</strong> <strong>and</strong> <strong>Sprite</strong> <strong>ActiveX</strong> Controls 659<br />
Fig. <strong>20</strong>.8<br />
Viewing an Animated Gif in Animation Shop<br />
© Copyright <strong>20</strong>00 by Prentice Hall. All Rights Reserved.<br />
For use only by instructors in classes for which Java How to Program, Third Edition is the required textbook.