{"id":697,"date":"2008-10-22T09:16:51","date_gmt":"2008-10-22T14:16:51","guid":{"rendered":"http:\/\/www.pixelwit.com\/blog\/?p=697"},"modified":"2009-08-15T19:46:00","modified_gmt":"2009-08-16T00:46:00","slug":"pageflip-version-detection-fix","status":"publish","type":"post","link":"https:\/\/www.pixelwit.com\/blog\/2008\/10\/22\/pageflip-version-detection-fix\/","title":{"rendered":"PageFlip Version Detection Fix"},"content":{"rendered":"<p>Unfortunately the release of Adobe Flash Player 10 has revealed a weakness in my version detection code.  As a result, the pageflip SWF will fail to load and viewers will be prompted to download the Flash 6 Player.  Fortunately there are 2 quick fixes<!--more-->.<\/p>\n<p><strong>Solution #1 (Bypass): <\/strong>If you didn&#8217;t modify the file too heavily and you don&#8217;t want to mess around in the Flash authoring environment then this solution might be for you:<\/p>\n<ol>\n<li>Download and save this &#8220;<a title=\"SWF Used to Properly Load PageFlip Files\" href=\"https:\/\/www.pixelwit.com\/blog\/wp-content\/uploads\/2008\/10\/pageflip-shim.swf\">pageflip-shim.swf<\/a>&#8221; file.<\/li>\n<li>Upload the &#8220;pageflip-shim.swf&#8221; file to the same directory as the file which needs to be fixed.<\/li>\n<li>Append &#8220;-content&#8221; to the name of the broken SWF file.  For example if your pageflip file is called &#8220;mybook.swf&#8221;, change its name to &#8220;mybook-content.swf&#8221;.<\/li>\n<li>Change the name of the &#8220;pageflip-shim.swf&#8221; to the original name of the broken SWF.  In this example you would change &#8220;pageflip-shim.swf&#8221; to &#8220;mybook.swf&#8221;.<\/li>\n<li>Now your HTML page will load the renamed &#8220;shim&#8221; file.  The shim file will then load a SWF file of the same name with &#8220;-content&#8221; appended to it.  Once the &#8216;content&#8217; file has sufficiently loaded, the &#8216;shim&#8217; file will send it to a frame beyond the faulty version detection code.<\/li>\n<\/ol>\n<p>Here&#8217;s the ActionScript used in the &#8220;pageflip-shim.swf&#8221; file:<\/p>\n<div class=\"codecolorer-container actionscript default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><div class=\"actionscript codecolorer\"><span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Set the stage properties.<\/span><br \/>\n<span class=\"kw3\">Stage<\/span>.<span class=\"kw3\">align<\/span> = <span class=\"st0\">&quot;TL&quot;<\/span>;<br \/>\n<span class=\"kw3\">Stage<\/span>.<span class=\"kw3\">scaleMode<\/span> = <span class=\"st0\">&quot;noScale&quot;<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Get the URL address of this file.<\/span><br \/>\n<span class=\"kw2\">var<\/span> <span class=\"kw3\">url<\/span> = <span class=\"kw3\">unescape<\/span><span class=\"br0\">&#40;<\/span><span class=\"kw3\">this<\/span>.<span class=\"kw3\">_url<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Determine the name of this file.<\/span><br \/>\nnameRoot = <span class=\"kw3\">url<\/span>.<span class=\"kw3\">slice<\/span><span class=\"br0\">&#40;<\/span><span class=\"kw3\">url<\/span>.<span class=\"kw3\">lastIndexOf<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;\/&quot;<\/span><span class=\"br0\">&#41;<\/span>+<span class=\"nu0\">1<\/span>, <span class=\"kw3\">url<\/span>.<span class=\"kw3\">lastIndexOf<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;.swf&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Create a clip to load the original pageflip file into.<\/span><br \/>\n<span class=\"kw3\">createEmptyMovieClip<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;Holder&quot;<\/span>, <span class=\"nu0\">1<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Maintain references to _root inside the clip being loaded.<\/span><br \/>\nHolder.<span class=\"kw3\">_lockroot<\/span> = <span class=\"kw2\">true<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Hide the pageflip file until the prompt to upgrade goes away.<\/span><br \/>\nHolder.<span class=\"kw3\">_x<\/span> = Holder.<span class=\"kw3\">_y<\/span> = <span class=\"nu0\">5000<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Load the original pageflip file,<\/span><br \/>\nHolder.<span class=\"kw3\">loadMovie<\/span><span class=\"br0\">&#40;<\/span>nameRoot+<span class=\"st0\">&quot;-content.swf&quot;<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Reveal the pageflip file after the prompt to upgrade goes way.<\/span><br \/>\n<span class=\"kw3\">onEnterFrame<\/span> = <span class=\"kw2\">function<\/span> <span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#40;<\/span>Holder._framesloaded<span class=\"sy0\">&gt;<\/span><span class=\"nu0\">4<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Holder.<span class=\"kw3\">gotoAndPlay<\/span><span class=\"br0\">&#40;<\/span><span class=\"nu0\">4<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Holder.<span class=\"kw3\">_x<\/span> = Holder.<span class=\"kw3\">_y<\/span> = <span class=\"nu0\">0<\/span>;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw3\">onEnterFrame<\/span> = <span class=\"kw2\">null<\/span>;<br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"co1\">\/\/<\/span><br \/>\n<span class=\"co1\">\/\/<\/span><\/div><\/div>\n<p><strong>Solution #2 (Remove): <\/strong>If the above solution doesn&#8217;t work for you, or if you don&#8217;t mind working within the Flash authoring environment, it&#8217;s extremely easy to remove the version detection from the FLA file.  Here&#8217;s how:<\/p>\n<ol>\n<li>Open your pageflip FLA file.<\/li>\n<li>Right-click the second frame of the &#8220;Actions&#8221; layer and choose &#8220;Clear Keyframe&#8221;.<\/li>\n<li>Right-click the third frame of the &#8220;Actions&#8221; layer and choose &#8220;Clear Keyframe&#8221;.<\/li>\n<li>Right-click the &#8220;Detector&#8221; layer and choose &#8220;Delete Layer&#8221;.<\/li>\n<li>Publish the new SWF file and upload it to your server.<\/li>\n<\/ol>\n<p>There is virtually no drawback to removing or bypassing the version detection code.  It only affects visitors with Adobe Flash Player 5 or lower, they&#8217;ll no longer see the blue prompt urging them to upgrade to Flash Player 6.<\/p>\n<p>I apologize for any inconvenience this may have caused.  Thanks for your understanding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial provides two solutions to correct a problem with faulty version detection in earlier versions of the Flash PageFlip effect.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[8],"tags":[26,37],"class_list":["post-697","post","type-post","status-publish","format-standard","hentry","category-flash","tag-pageflip","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/posts\/697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/comments?post=697"}],"version-history":[{"count":0,"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/posts\/697\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/media?parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/categories?post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pixelwit.com\/blog\/wp-json\/wp\/v2\/tags?post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}