home *** CD-ROM | disk | FTP | other *** search
/ Using Asymetrix Multimedi…ool Book Special Edition / SE_UAMT.iso / examples / ch22.tbk (.txt) < prev    next >
Encoding:
Asymetrix ToolBook File  |  1995-10-06  |  57.6 KB  |  847 lines

  1. Stage Page 2
  2. <BookPath>
  3. :HDMEDIAPATH
  4. System
  5. stoats8.bmp
  6. Stage Page 2
  7. Pusharound
  8. Scroll
  9. Page "Stage Page"
  10. Page id 0
  11. play sd wait
  12. buttonClick
  13. alias sd wait")
  14. 2play sd 
  15. zMCINotify s,c,d
  16. s = "successful"
  17. |close 
  18. = "Press 
  19. CDBSE&File
  20. &Open...    Ctrl+O
  21. &Save    Ctrl+S
  22. Save &As...
  23. saveas
  24. &Import...
  25. import
  26. &Export...
  27. export
  28. Print Set&up...
  29. printsetup
  30. &Print Pages...    Ctrl+P
  31. printpages
  32. Prin&t Report...
  33. printreport
  34. Send &Mail...
  35. sendmail
  36. &Run...
  37. E&xit    Alt+F4
  38. &Edit
  39. &Undo    Ctrl+Z
  40. Cu&t    Ctrl+X
  41. &Copy    Ctrl+C
  42. &Paste    Ctrl+V
  43. paste
  44. C&lear    Del
  45. clear
  46. Select &All    Shift+F9
  47. selectall
  48. Select Pa&ge    Shift+F12
  49. selectpage
  50. &Size to Page    F11
  51. sizetopage
  52. F&ind...    F5
  53. Re&place...
  54. replace
  55. Aut&hor    F3
  56. author
  57. &Text
  58. &Character...    F6
  59. character
  60. &Paragraph...    F7
  61. paragraph
  62. &Regular    Ctrl+Space
  63. regular
  64. &Bold    Ctrl+B
  65. &Italic    Ctrl+I
  66. italic
  67. &Underline    Ctrl+U
  68. underline
  69. Stri&keout    Ctrl+K
  70. strikeout
  71. Superscrip&t/Subscript
  72. superscriptSubscript
  73. &Normal Script
  74. normalscript
  75. Su&bscript    Ctrl+L
  76. subscript
  77. Su&perscript    Ctrl+Shift+L
  78. superscript
  79. &Show Hotwords    F9
  80. showhotwords
  81. &Page
  82. &Next    Alt+Right
  83. &Previous    Alt+Left
  84. previous
  85. &First    Alt+Up
  86. first
  87. &Last    Alt+Down
  88. &Back    Shift+F2
  89. &History...    Ctrl+F2
  90. history
  91. N&ew Page    Ctrl+N
  92. newpage
  93. &Help
  94. &Contents    F1
  95. contents
  96. Status &Bar    F12
  97. statusbar
  98. sful"
  99. |close 
  100. = "Press 
  101.     get callMCI(
  102.  && s)
  103.     get callMCI(
  104. close
  105.  && s)  -- or, get callMCI(
  106. close all
  107. END buttonClick
  108. Very well; what if the reference to the sound is needed elsewhere in the program? The answer might be to assign a system variable. But MCI, though not usually known for its elegance, provides a very clean way of dealing with media references: the alias.
  109. An alias is in fact a lot like a system variable,except that it can be used in a callMCI() function anywhere in the application (evenINSTALL LOG 
  110. MOUSE      
  111. AUTOEXECB~K 
  112. CONFIG  B~K 
  113. PMACLAN5   
  114. INSTALL TMP 
  115. CONFIG  1   
  116. AUTOEXEC1   
  117. CONFIG  2   
  118. AUTOEXEC2   
  119. AUTOEXEC3   
  120. PMACLAN VOL 
  121. CORELDRV   
  122. VR         
  123. WINWORD    
  124. Stage Page
  125. Stage Page
  126. -#,    #?
  127. ,%H.%
  128. where mm source max
  129. open d:\mtb30\samples\asym01.avi alias mm style child parent
  130. play mm
  131. buttonClick
  132. close mm
  133. MCINotify
  134. TO HANDLE buttonClick
  135. d:\mtb30\samples\asym01.avi alias mm style child 
  136. " && sysClientHandle && "wait")
  137. callMCI("where mm source 
  138. = " "
  139. = ","
  140. "dv" = ((
  141. ) + 1),((
  142. ) + 1)
  143. ("play mm",
  144. B"b")
  145. MCINotify
  146. close mm")
  147. isOpen 
  148. Natural Size
  149. close mm wait
  150. buttonClick
  151. TO HANDLE buttonClick
  152. callMCI("close mm wait")
  153. Close All
  154. -#,    #?
  155. ,%H.%
  156. where mm source max
  157. open d:\mtb30\samples\asym01.avi alias mm style child parent
  158. play mm
  159. buttonClick
  160. close mm
  161. MCINotify
  162. TO HANDLE buttonClick
  163. d:\mtb30\samples\asym01.avi alias mm style child 
  164. " && sysClientHandle && "wait")
  165. callMCI("where mm source 
  166. = " "
  167. = ","
  168. "dv" = 
  169. ("play mm",
  170. B"b")
  171. MCINotify
  172. close mm")
  173. isOpen 
  174. Natural Size
  175. TO HANDLE EnterPage
  176. 4LOGICAL scanning
  177. 4INT xs,ys
  178. --use the 
  179. 4property sysPageUnitsPerPixel 
  180. screen unit
  181. pixel conversions. You 
  182. e also 
  183. Uvarious 
  184. --functions.
  185. --Assign 
  186. _just 
  187. avoid having 
  188. so many
  189. T(though 
  190. wastes a few bytes 
  191. memory 
  192. a little 
  193.     xs = 
  194.     ys = 
  195. --Initialize 
  196. " flag so that 
  197.  = FALSE
  198. --Play a clip 
  199. stage.
  200.     mmPlay 
  201. "stoats" 
  202.  "scrl" 
  203. --Forward 
  204. message so higher levels receive 
  205. sysOpenMedia <> NULL
  206.         mmClose 
  207. 4POINT location
  208.  = TRUE
  209.  = mousePosition 
  210. handler will 
  211. appropriate
  212. --cursor 
  213. messages resume.
  214. |ploc,isShift,isCtrl,isRight
  215. bmpOffset
  216. bmpSlop
  217. bmpLoc
  218. thout processing 
  219. hourglass
  220. control key, 
  221. pressed:
  222. o= 4) 
  223. a repeating 
  224. , so prevent flicker 
  225. --slowdown 
  226. Hsetting 
  227. only 
  228. needed. Use 
  229. four-pointed
  230. o<> 7
  231. It - 
  232. It - 
  233. --mmVisualSize 
  234. a built-
  235. representing the
  236. --"actual" 
  237. source image. The 
  238. Hgetting 
  239. value 
  240.  could have been used instead. 
  241. --are assigned 
  242. It - 640) * xs
  243. It - 480) * ys
  244.  = thePos("
  245.  ) <= 0 \
  246. ) <= 0 \
  247. ) > -
  248. ) > -
  249. >kScroll
  250. --Update 
  251. bitmap:
  252. newPos 
  253. --Clear 
  254. stores 
  255. let Windows take over 
  256. attend 
  257. other needs, 
  258. --clog 
  259.     mmYield
  260. --This 
  261. a custom 
  262.  which uses imageCommand()
  263. units.
  264. passed 
  265. TO GET 
  266. g"status" \
  267.             && mmDeviceAlias 
  268.             && "
  269. wait")
  270. It * xs
  271. It * ys
  272. . A "TO SET" 
  273. --would 
  274. visually more elegant 
  275. Hway 
  276. balancing the
  277. --"TO GET" 
  278. , but a user 
  279. 's made up
  280. literals,
  281.     .. Don't forget 
  282. separate 
  283. a list 
  284. ; "," (comma).
  285. x1 = (
  286. q)/xs
  287. x2 = (
  288. q)/ys
  289.  "," (
  290. " && (
  291. q)/xs \
  292. & "," & (
  293. q)/ys && "
  294. --Restore 
  295. --isn't already 
  296. current 
  297. o<> 44
  298. o= 44
  299. Stage Page
  300. stoats
  301. Pusharound
  302. Scroll
  303. Page 5
  304. clippingWindow
  305. Pusharound
  306. enterPage
  307. Pusharound
  308. leavePage
  309. Pusharound
  310. viewerFromPoint
  311. buttonStillDown
  312. TO HANDLE 
  313. 4OBJECT clippingWindow
  314. "Pusharound"
  315.     focusWindow = 
  316. --Closing a 
  317. will suspend execution 
  318. begin 
  319. f. Either test 
  320. -ness 
  321. temporarily 
  322. FALSE 
  323. 4closing. This example uses a 
  324. isOpen 
  325.         close 
  326. viewerFromPoint = 
  327. Stage Page
  328. Press to Play
  329. open c:\windows\chimes.wav alias sd wait
  330. Playing
  331. play sd wait
  332. buttonClick
  333. successful
  334. close all
  335. Press to Play
  336. MCINotify
  337. TO HANDLE buttonClick
  338. = "Playing"
  339. callMCI("
  340. c:\windows\chimes.wav alias sd wait")
  341. 2play sd 
  342. zMCINotify s,c,d
  343. s = "successful"
  344. |close 
  345. = "Press 
  346. aying
  347. .WAV File
  348. <BookPath>
  349. :HDMEDIAPATH
  350. System
  351. enterBook
  352. TO HANDLE 
  353. Pusharound
  354. Page "Stage Page"
  355. Page id 0
  356. warning
  357. Page id 6
  358. CAUTION: ALTERNATE VERSION
  359. Pusharound Scroll
  360. -#,    #?
  361. ,%H.%
  362. where mm source max
  363. open d:\mtb30\samples\asym01.avi alias mm style child parent
  364. play mm
  365. buttonClick
  366. close mm
  367. MCINotify
  368. TO HANDLE buttonClick
  369. d:\mtb30\samples\asym01.avi alias mm style child 
  370. " && windowhandle 
  371. "dv" && "wait")
  372. callMCI("where mm source 
  373. = " "
  374. = ","
  375. "dv" = 
  376. ("play mm",
  377. B"b")
  378. MCINotify
  379. close mm")
  380. isOpen 
  381. close mm wait
  382. buttonClick
  383. TO HANDLE buttonClick
  384. callMCI("close mm wait")
  385. Close All
  386. Play in Popup Viewer
  387. speed
  388. enterPage
  389. -",    #>
  390. set mm speed
  391. buttonClick
  392. TO HANDLE buttonClick
  393. ZINT x
  394.     x = 
  395. callMCI("
  396. mm speed" & x)
  397. <> "4000"
  398. = "4000"
  399. = "1000"
  400. Speed 1000
  401. close mm wait
  402. buttonClick
  403. TO HANDLE buttonClick
  404. callMCI("close mm wait")
  405. Close All
  406. -#,    #?
  407. 1,    #?
  408. speed
  409. open d:\mtb30\samples\asym01.avi alias mm style child
  410. where mm source max
  411. parent
  412. put mm window at 160 70 0 0
  413. set mm speed
  414. play mm
  415. buttonClick
  416. close mm
  417. MCINotify
  418. TO HANDLE buttonClick
  419. d:\mtb30\samples\asym01.avi alias mm style child" \
  420. " && windowhandle 
  421. && "wait")
  422. callMCI("where mm source 
  423. )160 70 0 0")
  424. mm speed" && (
  425. ("play mm",
  426. B"b")
  427. MCINotify
  428. close mm")
  429. Press to play video in child window:
  430. Toggle  play speed between 1x (1000) and 4x (4000):
  431. -",    #>
  432. set mm speed
  433. buttonClick
  434. enterPage
  435. TO HANDLE buttonClick
  436. ZINT x
  437.     x = 
  438. callMCI("
  439. mm speed" & x)
  440. <> "4000"
  441. = "4000"
  442. = "1000"
  443. NOTIFYBEFORE 
  444. K= "1000"
  445. TO HANDLE EnterPage
  446. 4LOGICAL scanning
  447. 4INT xs,ys
  448. --use the 
  449. 4property sysPageUnitsPerPixel 
  450. screen unit
  451. pixel conversions. You 
  452. e also 
  453. Uvarious 
  454. --functions.
  455. --Assign 
  456. _just 
  457. avoid having 
  458. so many
  459. T(though 
  460. wastes a few bytes 
  461. memory 
  462. a little 
  463.     xs = 
  464.     ys = 
  465. --Initialize 
  466. " flag so that 
  467.  = FALSE
  468. --Play a clip 
  469. stage.
  470.      "scrl" 
  471. = "0,0"
  472.     mmPlay 
  473. 3"stoats" 
  474. --Forward 
  475. message so higher levels receive 
  476. sysOpenMedia <> NULL
  477.         mmClose 
  478. 4POINT location
  479.  = TRUE
  480.  = mousePosition 
  481. handler will 
  482. appropriate
  483. --cursor 
  484. messages resume.
  485. |ploc,isShift,isCtrl,isRight
  486. bmpOffset
  487. bmpSlop
  488. bmpLoc
  489. thout processing 
  490. hourglass
  491. control key, 
  492. pressed:
  493. o= 4) 
  494. a repeating 
  495. , so prevent flicker 
  496. --slowdown 
  497. Hsetting 
  498. only 
  499. needed. Use 
  500. four-pointed
  501. o<> 7
  502. It - 
  503. It - 
  504. --mmVisualSize 
  505. a built-
  506. representing the
  507. --"actual" 
  508. source image. The 
  509. Hgetting 
  510. value 
  511.  could have been used instead. 
  512. --are assigned 
  513. It - 640) * xs
  514. It - 480) * ys
  515.  = thePos("
  516.  ) <= 0 \
  517. ) <= 0 \
  518. ) > -
  519. ) > -
  520. --Update 
  521. bitmap:
  522. newPos 
  523. --Clear 
  524. stores 
  525. let Windows take over 
  526. attend 
  527. other needs, 
  528. --clog 
  529.     mmYield
  530. --This 
  531. a custom 
  532.  which uses imageCommand()
  533. units.
  534. passed 
  535. TO GET 
  536. g"status" \
  537.             && mmDeviceAlias 
  538.             && "
  539. wait")
  540. It * xs
  541. It * ys
  542. . A "TO SET" 
  543. --would 
  544. visually more elegant 
  545. Hway 
  546. balancing the
  547. --"TO GET" 
  548. , but a user 
  549. 's made up
  550. literals,
  551.     .. Don't forget 
  552. separate 
  553. a list 
  554. ; "," (comma).
  555. " && (
  556. q)/xs \
  557. & "," & (
  558. q)/ys && "
  559. --Restore 
  560. --isn't already 
  561. current 
  562. o<> 44
  563. o= 44
  564. 7    TO HANDLE EnterPage
  565. 4LOGICAL scanning
  566. 4INT xs,ys
  567.     SHOW VIEWER "WARNING"
  568. --use the 
  569. 4property sysPageUnitsPerPixel 
  570. screen unit
  571. pixel conversions. You 
  572. ~ also 
  573. Uvarious 
  574. --functions.
  575. --Assign 
  576. _just 
  577. avoid having 
  578. so many
  579. T(though 
  580. wastes a few bytes 
  581. memory 
  582. a little 
  583.     xs = 
  584.     ys = 
  585. --Initialize 
  586. " flag so that 
  587.  = FALSE
  588. --Play a clip 
  589. stage.
  590.  "scrl" 
  591. = "0,0"
  592.     mmPlay 
  593. 2"stoats" 
  594. --Forward 
  595. message so higher levels receive 
  596. sysOpenMedia <> NULL
  597.         mmClose 
  598.     IF ISOPEN OF 
  599.         CLOSE 
  600. 4POINT location
  601.  = TRUE
  602.  = mousePosition 
  603. handler will 
  604. appropriate
  605. --cursor 
  606. messages resume.
  607. |ploc,isShift,isCtrl,isRight
  608. bmpOffset
  609. bmpSlop
  610. bmpLoc
  611. thout processing 
  612. hourglass
  613. control key, 
  614. pressed:
  615. o= 4) 
  616. a repeating 
  617. , so prevent flicker 
  618. --slowdown 
  619. Hsetting 
  620. only 
  621. needed. Use 
  622. question mark
  623. special 
  624. o<> 38
  625. o= 38
  626. It - 
  627. It - 
  628. --mmVisualSize 
  629. a built-
  630. representing the
  631. --"actual" 
  632. source image. The 
  633. Hgetting 
  634. value 
  635.  could have been used instead. 
  636. --are assigned 
  637. It - 640) * xs
  638. It - 480) * ys
  639.  = thePos("
  640.  ) <= 0 \
  641. ) <= 0 \
  642. ) > -
  643. ) > -
  644. --Update 
  645. bitmap:
  646. newPos 
  647. --Clear 
  648. stores 
  649. let Windows take over 
  650. attend 
  651. other needs, 
  652. --clog 
  653.     mmYield
  654. TO GET 
  655. --Restore 
  656. --isn't already 
  657. current 
  658. o<> 44
  659. o= 44
  660. -#,    #?
  661. MoveWindow
  662. +!MoveWindow
  663. where mm source max
  664. status mm window handle
  665. play mm
  666. alias mm style child parent
  667. buttonClick
  668. close mm
  669. MCINotify
  670. TO HANDLE buttonClick
  671. ZWORD hWnd
  672. "file"
  673. " && 
  674. && "alias mm style child 
  675. " && sysClientHandle && "wait")
  676. \ = callMCI("status mm 
  677. where mm source 
  678. linkDLL "USER"
  679. INT MoveWindow(
  680. )+1, (
  681. )+1, 1)
  682. ("play mm",
  683. MCINotify
  684. close mm")
  685. unlinkDLL "
  686. Add 1 Pixel to Size
  687. close mm wait
  688. buttonClick
  689. TO HANDLE buttonClick
  690. callMCI("close mm wait")
  691. Close All
  692. -#,    #?
  693. MoveWindow
  694. +!MoveWindow
  695. where mm source max
  696. status mm window handle
  697. play mm
  698. alias mm style child parent
  699. buttonClick
  700. close mm
  701. MCINotify
  702. TO HANDLE buttonClick
  703. ZWORD hWnd
  704. "file"
  705. " && 
  706. && "alias mm style child 
  707. " && sysClientHandle && "wait")
  708. \ = callMCI("status mm 
  709. where mm source 
  710. linkDLL "USER"
  711. INT MoveWindow(
  712. ), 1)
  713. ("play mm",
  714. MCINotify
  715. close mm")
  716. unlinkDLL "
  717. Natural Size
  718. -#,    #?
  719. MoveWindow
  720. +!MoveWindow
  721. where mm source max
  722. status mm window handle
  723. play mm
  724. alias mm style child parent
  725. buttonClick
  726. close mm
  727. MCINotify
  728. TO HANDLE buttonClick
  729. ZWORD hWnd
  730. "file"
  731. " && 
  732. && "alias mm style child 
  733. " && sysClientHandle && "wait")
  734. \ = callMCI("status mm 
  735. where mm source 
  736. linkDLL "USER"
  737. INT MoveWindow(
  738. ) - 3, (
  739. ) - 3, 1)
  740. ("play mm",
  741. MCINotify
  742. close mm")
  743. unlinkDLL "
  744. Subtract 1 Pixel from Size
  745. d:\mtb40\samples\asym01.avi
  746. File:
  747. rce max
  748. status mm window handle
  749. open d:\mtb30\samples\asym01.avi alias mm style child parent
  750. play mm
  751. buttonClick
  752. close mm
  753. MCINotify
  754. TO HANDLE buttonClick
  755. d:\mtb30\samples\asym01.avi alias mm style child 
  756. " && sysClientHandle && "wait")
  757. hWnd = callMCI("status mm 
  758. where mm source 
  759. linkDLL "USER"
  760.     INT MoveWindow(WORD,
  761. ("play mm",
  762. MCINotify
  763. close mm")
  764.     unlinkDLL "
  765. --Restore 
  766. --isn't already 
  767. R    current 
  768. o<> 44
  769. o= 44
  770. scanning
  771. stoats
  772. EnterPage
  773. leavePage
  774. scanning
  775. location
  776. buttonDown
  777. .&+    +E
  778. scanning
  779. buttonUp
  780. .&+    +E
  781. +",!Y
  782. +",!Y
  783. thePos
  784. location
  785. 8#newPos
  786. stoats
  787. buttonStillDown
  788. +",!Y
  789. +",!Y
  790. position wait
  791. status
  792. thePos
  793. +",!Y
  794. V,    #?
  795. +",!Y
  796. V,    #>
  797. window
  798. position
  799. newPos
  800. .&+    +E
  801. scanning
  802. WARNING
  803. stoats
  804. EnterPage
  805. WARNING
  806. leavePage
  807. scanning
  808. location
  809. buttonDown
  810. .&+    +E
  811. scanning
  812. buttonUp
  813. .&+    +E
  814. +",!Y
  815. +",!Y
  816. thePos
  817. location
  818. 8#newPos
  819. stoats
  820. buttonStillDown
  821. thePos
  822. newPos
  823. .&+    +E
  824. !xx!!
  825. 9!9xx
  826. !.          
  827. ..         
  828. MTB12   DSK
  829. MTB13   DSK
  830. MTB14W6 DOC 
  831. MTB14   DSK
  832. COVER_W2DOC 
  833. BNCHMARKTBK 
  834. CH13XTRADOC 
  835. MTB22   DSK
  836. TB22W2 DOC 
  837. MTB15   TXT 
  838. MTB15   DSK
  839. TB15   DOC 
  840. !xx!!
  841. 9!9xx
  842. !xx!!
  843. 9!9xx
  844. !IO      SYS
  845. MSDOS   SYS
  846. MS-DOS_6   (
  847.