{"id":110,"date":"2006-07-10T10:43:52","date_gmt":"2006-07-10T02:43:52","guid":{"rendered":"http:\/\/tmp.xujiwei.com\/blog\/?p=110"},"modified":"2013-03-11T20:24:27","modified_gmt":"2013-03-11T12:24:27","slug":"write-a-flashplayer-in-vb","status":"publish","type":"post","link":"https:\/\/xujiwei.com\/blog\/2006\/07\/write-a-flashplayer-in-vb\/","title":{"rendered":"\u7528VB\u5199\u4e00\u4e2a\u4f60\u81ea\u5df1\u7684Flash\u64ad\u653e\u5668"},"content":{"rendered":"<p>\u524d\u5929\u5728PConline\u4e0b\u4e86\u4e00\u4e2a\u5b59\u946b\u7684\u300aJava\u4ece\u5165\u95e8\u5230\u7cbe\u901a\u300b\u7684\u89c6\u9891\u6559\u7a0b\uff0cFlash\u683c\u5f0f\uff0c\u5728\u770b\u7684\u65f6\u5019\u611f\u89c9\u5f88\u4e0d\u723d\uff0c\u6bcf\u4e00\u8bfe\u5f00\u59cb\u7684\u65f6\u5019\u6709\u4e00\u5927\u6bb5\u5e7f \u544a\uff0c\u800c\u4e14\u524d\u9762\u7684\u4e00\u90e8\u5206\u9887\u4e3a\u5570\u55e6\uff0c\u8bb2\u4e86\u4e71\u4e03\u516b\u7cdf\u7684\u4e1c\u897f\uff0c\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u56e0\u4e3a\u201c\u5165\u95e8\u201d\u7684\u5173\u7cfb\uff0c\u7136\u540e\u5c31\u628a\u4ee5\u524d\u505a\u7684\u4e00\u4e2aFlash\u64ad\u653e\u5668\u627e\u51fa\u6765\uff0c\u76f4\u63a5\u8df3\u5230\u81ea\u5df1\u8981\u770b\u7684 \u5730\u65b9\uff5e<\/p>\n<p>\u8981\u60f3\u7528VB\u505a\u4e00\u4e2a\u81ea\u5df1\u7684Flash\u64ad\u653e\u5668\u8fd8\u662f\u6bd4\u8f83\u65b9\u4fbf\u7684\uff0c\u56e0\u4e3aMacromedia\u5df2\u7ecf\u63d0\u4f9b\u4e86Shockwave\u00a0Flash\u63a7\u4ef6\uff0c \u53ef\u4ee5\u65b9\u4fbf\u6765\u7684\u64ad\u653eFlash\u5f71\u7247\u3002\u8981\u60f3\u4f7f\u7528\u8fd9\u4e2a\u63a7\u4ef6\uff0c\u9996\u5148\u8981\u5728\u5de5\u7a0b\u91cc\u6dfb\u52a0\u8fd9\u4e2a\u63a7\u4ef6\uff0c\u9009\u4e2d\u83dc\u5355\u201c\u5de5\u7a0b-&gt;\u90e8\u4ef6\u201d\uff0c\u627e\u5230 Shockwave\u00a0Flash\uff0c\u6253\u4e0a\u52fe\uff0c\u786e\u5b9a\u5c31\u53ef\u4ee5\u4e86\u3002\u53e6\u5916\uff0c\u56e0\u4e3a\u8981\u52a0\u8f7dFlash\u5f71\u7247\uff0c\u6240\u4ee5\u6211\u4eec\u8fd8\u9700\u8981\u52a0\u5165\u5bf9\u8bdd\u6846\u63a7\u4ef6 Microsoft\u00a0Common\u00a0Dialog\u00a0Control\u3002<\/p>\n<p>\u505a\u8fd9\u4e2aFlash\u64ad\u653e\u5668\u4e4b\u524d\uff0c\u5148\u7528\u5bf9\u8c61\u6d4f\u89c8\u5668\u6765\u770b\u4e00\u4e0b Shockwave\u00a0Flash\u63a7\u4ef6\u6709\u54ea\u4e9b\u6211\u4eec\u9700\u8981\u7684\u4e8b\u4ef6\u3001\u65b9\u6cd5\u548c\u5c5e\u6027\u3002<\/p>\n<p>\u56e0\u4e3a\u6211\u4eec\u505a\u7684Flash\u64ad\u653e\u5668\u6bd4\u8f83\u7b80\u5355\uff0c\u6240\u4ee5\u6ca1\u6709\u53ef\u4ee5\u5229\u7528\u7684\u63a7\u4ef6\u4e8b \u4ef6\u3002<\/p>\n<p><strong>\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p><strong>Sub\u00a0Back()<\/strong><\/p>\n<p>\u8df3 \u5230\u524d\u4e00\u5e27\uff0c\u76f8\u5f53\u4e8eFlash\u53f3\u952e\u83dc\u5355\u4e2d\u7684\u5feb\u9000<\/p>\n<p><strong>Function\u00a0CurrentFrame()\u00a0As\u00a0Long<\/strong><\/p>\n<p>\u83b7 \u53d6\u5f53\u524d\u64ad\u653e\u7684\u4e3a\u7b2c\u51e0\u5e27<\/p>\n<p><strong>Sub\u00a0Forward()<\/strong><\/p>\n<p>\u8df3\u5230\u540e\u4e00\u5e27\uff0c\u76f8\u5f53\u4e8eFlash \u53f3\u952e\u83dc\u5355\u4e2d\u7684\u5feb\u8fdb<\/p>\n<p><strong>Sub\u00a0GotoFrame(FrameNum\u00a0As\u00a0Long)<\/strong><\/p>\n<p>\u8df3 \u5230\u6307\u5b9a\u5e27\uff0c\u8fd9\u662f\u4e00\u4e2a\u76f8\u5f53\u6709\u7528\u7684\u65b9\u6cd5\uff0c\u4e5f\u662f\u8981\u505a\u8fd9\u4e2aFlash\u64ad\u653e\u5668\u7684\u7406\u7531\u4e4b\u4e00\u4e86<\/p>\n<p><strong>Sub\u00a0Play()<\/strong><\/p>\n<p>\u64ad \u653e\uff0c\u76f8\u5f53\u4e8eFlash\u4e2d\u7684\u64ad\u653e<\/p>\n<p><strong>Sub\u00a0Stop()<\/strong><\/p>\n<p>\u505c\u6b62\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\u8fd9\u4e2a\u662f\u505c \u6b62\uff0c\u800c\u4e0d\u662f\u6682\u505c\uff0c\u505c\u6b62\u540e\u518d\u5f00\u59cb\u64ad\u653e\u5c06\u4ece\u7b2c1\u5e27\u5f00\u59cb<\/p>\n<p><strong>Sub\u00a0StopPlay()<\/strong><\/p>\n<p>\u6682 \u505c\uff0c\u6682\u505c\u540e\u518d\u64ad\u653e\u662f\u7ee7\u7eed\u6682\u505c\u4e4b\u524d\u7684\u72b6\u6001<\/p>\n<p><strong>\u5c5e\u6027\uff1a<\/strong><\/p>\n<p><strong>Property\u00a0Movie\u00a0As\u00a0String<\/strong><\/p>\n<p>\u5f71 \u7247\u8def\u5f84\uff0c\u7528\u6765\u52a0\u8f7d\u8981\u64ad\u653e\u7684Flash\u5f71\u7247<\/p>\n<p><strong>Property\u00a0Playing\u00a0As\u00a0Boolean<\/strong><\/p>\n<p>\u662f \u5426\u6b63\u5728\u64ad\u653e<\/p>\n<p><strong>TotalFrames<\/strong><\/p>\n<p>Flash\u5f71\u7247\u7684\u603b\u5e27\u6570<\/p>\n<p>\u597d\u4e86\uff0c \u6709\u4e86\u8fd9\u4e9b\u8d44\u6599\u5c31\u53ef\u4ee5\u5f00\u59cb\u5199\u81ea\u5df1\u7684Flash\u64ad\u653e\u4e86\uff5e<\/p>\n<p>\u6253\u5f00\u7a97\u4f53\u7f16\u8f91\u5668\uff0c\u5148\u5728\u7a97\u4f53\u6dfb\u52a05\u4e2a\u6309\u94ae\uff0c\u540d\u79f0\u548cCaption\u5206\u522b \u4e3a\uff1acmdOpen(\"\u6253\u5f00\")\uff0ccmdPlay(\"\u64ad\u653e\")\uff0ccmdStop(\"\u505c\u6b62\")\uff0ccmdPrev(\"\u524d\u4e00\u5e27\")\uff0ccmdNext(\"\u540e\u4e00 \u5e27\")\u3002\u4e3a\u4e86\u80fd\u5feb\u6574\u8df3\u8f6c\uff0c\u518d\u6dfb\u52a0\u4e00\u4e2a\u6c34\u5e73\u6eda\u52a8\u6761\uff0c\u540d\u79f0\u4e3ahslFrame\u3002\u5f53\u7136\uff0c\u6700\u91cd\u8981\u7684\uff0cShockwave\u00a0Flash\u4e0d\u80fd\u5c11\u4e86\uff0c\u4e5f\u8981\u6dfb\u52a0\uff0c\u540d\u79f0\u4e3a swf\u3002\u518d\u8005\u8981\u6253\u5f00\u6587\u4ef6\uff0c\u6240\u4ee5\u6dfb\u52a0\u4e00\u4e2aMicrosoft\u00a0Common\u00a0Dialog\u00a0Control\uff0c\u540d\u79f0\u4e3adlg\u3002<\/p>\n<p><a href=\"http:\/\/xujiwei.com\/blog\/wp-content\/uploads\/2010\/01\/sphw_step1.jpg\" data-lbwps-width=\"409\" data-lbwps-height=\"359\" data-lbwps-srcsmall=\"https:\/\/xujiwei.com\/blog\/wp-content\/uploads\/2010\/01\/sphw_step1.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-111\" title=\"sphw_step1\" src=\"http:\/\/xujiwei.com\/blog\/wp-content\/uploads\/2010\/01\/sphw_step1.jpg\" alt=\"\" width=\"409\" height=\"359\" \/><\/a><\/p>\n<p>\u5b8c\u6210\u7a97\u4f53\u7684\u8bbe\u8ba1\uff0c\u5f00\u59cb\u7f16\u5199\u4ee3\u7801\u3002<\/p>\n<blockquote><p><span style=\"font-style: normal;\">'\u00a0\u5148\u7ed9\u6253\u5f00\u6309\u94ae\u6dfb\u52a0\u8fc7\u7a0b<\/span><\/p>\n<p><span style=\"font-style: normal;\">Private\u00a0Sub\u00a0cmdOpen_Click()<\/span><\/p>\n<p><span style=\"font-style: normal;\">dlg.Filter\u00a0=\u00a0\"Flash(*.swf)|*.swf\"\u00a0\u00a0'\u00a0\u8bbe \u7f6e\u6587\u4ef6\u540d\u8fc7\u6ee4\u5668\uff0c\u53ea\u663e\u793aFlash\u6587\u4ef6<\/span><\/p>\n<p><span style=\"font-style: normal;\">dlg.ShowOpen<\/span><\/p>\n<p><span style=\"font-style: normal;\">If\u00a0dlg.FileName\u00a0=\u00a0\"\"\u00a0Then\u00a0Exit\u00a0Sub\u00a0'\u00a0\u5982 \u679c\u7528\u6237\u70b9\u4e86\u53d6\u6d88\u5219\u9000\u51fa\u5904\u7406<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.Movie\u00a0=\u00a0dlg.FileName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'\u00a0\u52a0\u8f7d\u5f71\u7247<\/span><\/p>\n<p><span style=\"font-style: normal;\">hslFrame.Max\u00a0=\u00a0swf.TotalFrames\u00a0\u00a0\u00a0\u00a0\u00a0'\u00a0\u83b7 \u53d6\u603b\u5e27\u6570\uff0c\u5e76\u8d4b\u503c\u7ed9\u6eda\u52a8\u6761\u7684\u6700\u5927\u503c<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0Sub<\/span><\/p>\n<p><span style=\"font-style: normal;\">'\u00a0\u63a5\u7740\u662f\u64ad\u653e\u6309\u94ae<\/span><\/p>\n<p><span style=\"font-style: normal;\">Private\u00a0Sub\u00a0cmdPlay_Click()<\/span><\/p>\n<p><span style=\"font-style: normal;\">If\u00a0swf.Playing\u00a0=\u00a0True\u00a0Then\u00a0\u00a0\u00a0'\u00a0\u5982 \u679c\u6b63\u5728\u64ad\u653e\u5219\u6682\u505c<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.StopPlay<\/span><\/p>\n<p><span style=\"font-style: normal;\">cmdPlay.Caption\u00a0=\u00a0\"\u64ad \u653e\"\u00a0'\u00a0\u6309\u94ae\u6587\u672c\u8bbe\u7f6e\u4e3a\u201c\u64ad\u653e\u201d<\/span><\/p>\n<p><span style=\"font-style: normal;\">Else<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.Play\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'\u00a0\u5426 \u5219\u5c31\u7ee7\u7eed\u64ad\u653e<\/span><\/p>\n<p><span style=\"font-style: normal;\">cmdPlay.Caption\u00a0=\u00a0\"\u6682\u505c\"\u00a0'\u00a0\u6309\u94ae\u6587\u672c\u8bbe\u7f6e\u4e3a\u201c\u6682\u505c\u201d<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0If<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0Sub<\/span><\/p>\n<p><span style=\"font-style: normal;\">'\u00a0\u505c \u6b62\u6309\u94ae<\/span><\/p>\n<p><span style=\"font-style: normal;\">Private\u00a0Sub\u00a0cmdStop_Click()<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.Stop\u00a0\u00a0'\u00a0\u505c\u6b62<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0Sub<\/span><\/p>\n<p><span style=\"font-style: normal;\">'\u00a0\u524d \u4e00\u5e27\u6309\u94ae<\/span><\/p>\n<p><span style=\"font-style: normal;\">Private\u00a0Sub\u00a0cmdPrev_Click()<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.Back<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0Sub<\/span><\/p>\n<p><span style=\"font-style: normal;\">'\u00a0\u540e \u4e00\u5e27\u6309\u94ae<\/span><\/p>\n<p><span style=\"font-style: normal;\">Private\u00a0Sub\u00a0cmdNext_Click()<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.Forward<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0Sub<\/span><\/p>\n<p><span style=\"font-style: normal;\">'\u00a0\u4e3a \u4e86\u53ef\u4ee5\u62d6\u52a8\u6eda\u52a8\u6761\u6765\u8fdb\u884c\u64ad\u653e\uff0c\u4e0b\u9762\u5904\u7406hslFrame\u7684OnChange\u4e8b\u4ef6<\/span><\/p>\n<p><span style=\"font-style: normal;\">Private\u00a0Sub\u00a0hslFrame_Change()<\/span><\/p>\n<p><span style=\"font-style: normal;\">swf.GotoFrame\u00a0hslFrame.Value\u00a0\u00a0'\u00a0\u8df3 \u5230\u6eda\u52a8\u6761\u503c\u6240\u5728\u7684\u5e27<\/span><\/p>\n<p><span style=\"font-style: normal;\">End\u00a0Sub<\/span><\/p><\/blockquote>\n<p>\u597d\u4e86\uff0c\u4e00\u4e2a\u7b80\u5355\u7684Flahs\u64ad\u653e\u5668\u5c31\u505a\u597d\u4e86\uff0c\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u5728\u8fd9\u4e2a\u6b64\u57fa\u7840\u4e0a\u52a0\u4e0a\u66f4\u591a\u7684\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u5929\u5728PConline\u4e0b\u4e86\u4e00\u4e2a\u5b59\u946b\u7684\u300aJava\u4ece\u5165\u95e8\u5230\u7cbe\u901a\u300b\u7684\u89c6\u9891\u6559\u7a0b\uff0cFlas &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/xujiwei.com\/blog\/2006\/07\/write-a-flashplayer-in-vb\/\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[79,76],"_links":{"self":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts\/110"}],"collection":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":0,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"wp:attachment":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}