Flash Full Screen Button

Discussion in 'Programming' started by twalters84, Jun 7, 2010.

  1. #1
    Greetings,

    I want a "Business Map Search" button on every page of my website like the one linked in this sentence next to the sign-up button.

    I am trying to avoid loading libraries and other swf files until they are needed to save bandwidth and page loading time. The button was originally just an image file with an onclick javascript function that replaced the button with a swf flash file. I soon discovered that I could not have "StageDisplayState.FULL_SCREEN" just anywhere in the flash file. It has to be in response to a mouse click or key press. Otherwise, I got flash security error #2152.

    One coder suggested I use plain object code to load the flash swf file to avoid having to load the swfobject library. So I started loading the file like so:

    
    <cfset myFlashVars = 'NEW_CENTER_LATITUDE=#MY_GEO_LATITUDE#&amp;NEW_CENTER_LONGITUDE=#MY_GEO_LONGITUDE#&amp;LATITUDE=#MY_GEO_LATITUDE#'>
    <cfset myFlashVars = '#myFlashVars#&amp;LONGITUDE=#MY_GEO_LONGITUDE#&amp;MILES=500&amp;MAX_MARKERS=100&amp;UPDATE_MAP=1&amp;ZOOM=4'>
    <cfset myFlashVars = '#myFlashVars#&amp;MAP_PROVIDER=BING&amp;FULL_SCREEN=1'>
        
    <object data="http://www.green-watch.org/sample3.swf" type="application/x-shockwave-flash" width="91" height="25">
                 
      <param name="width" value="91" />
      <param name="height" value="25" />          
      <param name="src" value="http://www.green-watch.org/sample3.swf" />
      <param name="id" value="myFlashMap" />
      <param name="wmode" value="transparent" />
      <param name="allowscriptaccess" value="sameDomain" />
      <param name="allowfullscreen" value="true" />
      <param name="quality" value="high" />
      <param name="bgcolor" value="#FFFFFF" />
      <param name="name" value="myFlashMap" />
      <param name="FlashVars" value="<cfoutput>#myFlashVars#</cfoutput>" />
                            
    </object> 
    
    Code (markup):
    The nice thing about the code above is that it embeds the flash swf file on the page, the code is W3C compliant, and I do not need to load the swfobject library. I made the button entirely flash at this point which can be found here: Map Search Button. With this flash file, the user clicks the map search button, the click event preloads the map swf file which is much larger, and then displays a second button. Instead of displaying the second button, I want the map search to go full screen automatically.

    To solve the one click issue, I have tried preloading the map file first and then displaying the button like on this page here: Map Search Button 2. The problem with this is the huge map file gets loaded on every page load. This would kill bandwidth and really increase my page load time. So I need the preloading to occur after the initial click event occurs.

    I need a "Map Search" button that the user clicks, preloading takes place, and then it goes full screen after reaching 100% loaded.

    Please note, I have also tried setInterval and clearInterval inside the button click event waiting for the preloader to trigger 100 percent. The same security error comes up though.

    Sincerely,
    Travis Walters
     
    twalters84, Jun 7, 2010 IP