{"id":99001,"date":"2011-06-14T09:56:49","date_gmt":"2011-06-14T01:56:49","guid":{"rendered":"\/2011\/06\/14\/HTML_FLASH.html"},"modified":"2011-06-14T09:56:49","modified_gmt":"2011-06-14T01:56:49","slug":"html_flash","status":"publish","type":"post","link":"https:\/\/blog.zhenglei.net\/?p=99001","title":{"rendered":"Passing parameter from HTML to Flash in Adobe CS4"},"content":{"rendered":"<p>Suppoe we need pass the video name from HTML to Flash.<\/p>\n<p><strong>1.&nbsp;&nbsp; Add the following&nbsp; ActionScript into FLA:<\/strong><\/p>\n<p># Display the video in screen<\/p>\n<p>var my_fmt = new TextFormat();<br \/>my_fmt.color = 0xFF0000;<br \/>my_fmt.underline = true;<br \/>this.createTextField(&#8220;myTxt&#8221;, 1, 320, 10, 200, 20);<br \/>myTxt.autoSize = &#8220;left&#8221;;<br \/>myTxt.setTextFormat(my_fmt);<\/p>\n<p>#&nbsp; myVIDEO is the parameter from HTML<br \/>if (myVIDEO == undefined) {<br \/>myTxt.text = &#8220;Keynote_1.flv&#8221;;<br \/>} else {<br \/>myTxt.text = myVIDEO;<br \/>}<\/p>\n<p>\/\/ create basic netConnection object<br \/>var nc:NetConnection = new NetConnection();<\/p>\n<p>\/\/ connect to the local Red5 server<br \/>nc.connect(&#8220;rtmp:\/\/192.168.127.127\/oflaDemo&#8221;);<\/p>\n<p>\/\/ create the netStream object and pass the netConnection object in the constructor<br \/>var ns:NetStream = new NetStream(nc);<\/p>\n<p>\/\/ attach the netStream object to the video object<br \/>videoContainer.attachVideo(ns);<\/p>\n<p>\/\/ Play the video<br \/>ns.play(myTxt.text);<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2.&nbsp; Generate the SWF and HTML from FLA<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>3. <strong>Modify the generated HTML to add myVIDEO parameter<\/strong>,<\/p>\n<p>&nbsp;&nbsp; Three parts to be modified in HTML:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;&nbsp; A)&nbsp; Add the following line in the&nbsp; <span style=\"color: #0000ff;\"><em>AC_FL_RunContent<\/em><\/span> block:<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;FlashVars&#8217;,&#8217;myVIDEO=Keynote_2.flv&#8217;,<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; B)&nbsp; Add the following line in the&nbsp; <span style=\"color: #0000ff;\"><em>Object<\/em><\/span> block:<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param name=&#8221;FlashVars&#8221; value=&#8221;myVIDEO=Keynote_2.flv&#8221; \/&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; C)&nbsp; Add the following into the embed scr block:<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; FlashVars=&#8221;myVIDEO=Keynote_2.flv&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/commondatastorage.googleapis.com\/red5.zhenglei.net\/Pass_Variable_From_Html_To_Flash.7z\">http:\/\/commondatastorage.googleapis.com\/red5.zhenglei.net\/Pass_Variable_From_Html_To_Flash.7z<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Passing parameter from HTML to FLASH swf file, in Adobe Flash CS4 <a href=\"https:\/\/blog.zhenglei.net\/?p=99001\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,13,15,12],"tags":[27],"class_list":["post-99001","post","type-post","status-publish","format-standard","hentry","category-flash","category-html","category-red5","category-streaming","tag-flash-2"],"_links":{"self":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/99001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=99001"}],"version-history":[{"count":0,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/99001\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=99001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=99001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=99001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}