sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Mac WebDialog & Flash

    Scheduled Pinned Locked Moved Developers' Forum
    24 Posts 5 Posters 4.3k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tomasz
      last edited by

      Hi,
      I have noticed that a web-dialog with a Flash content doesn't display it on Mac. Safari displays the page just fine. It works also perfectly under Windows inside SU.

      Have someone had a success using flash inside a web-dialog on Mac?

      Tomasz

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by

        Never tried it.

        1 Reply Last reply Reply Quote 0
        • T Offline
          tomasz
          last edited by

          Maybe the security is set high on Mac.
          I decided to check whether .set_full_security=false helps..
          Why am I not surprised I have received such an error:

          @unknownuser said:

          Error: #<NoMethodError: undefined method `set_full_security=' for #UI::WebDialog:0x8e55c60>

          I decided to check: UI::Webdialog.public_instance_methods
          I have found set_full_security and tried: set_full_security(false)
          and received

          @unknownuser said:

          Error: #<ArgumentError: wrong number of arguments(1 for 0)>

          What a mess!
          There is no method to set it low am I right?

          @unknownuser said:

          ["set_position", "set_background_color", "navigation_buttons_enabled=", "navigation_buttons_enabled?", "min_width", "min_height=", "set_full_security", "last_height", "set_html", "execute_script", "max_height", "get_default_dialog_color", "set_size", "min_width=", "show_modal", "close", "bring_to_front", "last_height=", "last_width", "post_url", "max_width", "max_height=", "add_action_callback", "show", "visible?", "set_on_close", "last_width=", "set_url", "min_height", "max_width=", "get_element_value", "write_image", "set_file", "allow_actions_from_host"]

          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

          1 Reply Last reply Reply Quote 0
          • scottliningerS Offline
            scottlininger
            last edited by

            Tomasz,

            Flash has worked for me in a ruby webdialog on the mac. We use it in the Get Photo Texture extension, for example.

            How are are initializing your flash movie? Are you using javascript to create the <object><embed> tags? Or manually writing them into your html? If you're using JS, it might be trying to detect that flash is installed or some such, and getting confused about which browser it is running in.

            Simple test: create a WebDialog and point it to some public websites that run flash, like Streetview or YouTube.

            The JS code that has worked for me in the past is something like...

            <body onload="onLoad()">
            <script>
            function onLoad() {
              var path = 'myMovie.swf';
              var html = ['<object classid="clsid;d27cdb6e-ae6d-11cf-96b8-444553540000" ',
                  'codebase="http://download.macromedia.com/pub/shockwave/cabs/',
                  'flash/swflash.cab#version=9,0,0,0" ',
                  'id="flash">',
                  '<param name="allowScriptAccess" value="always" />',
                  '<param name="allowFullScreen" value="false" />',
                  '<param name="movie" ',
                  'value="', path, '" />',
                  '<param name="quality" value="high" />',
                  '<param name="scale" value="noscale" />',
                  '<param name="swLiveConnect" value="true" />',
                  '<param name="salign" value="lt" />',
                  '<param name="wmode" value="transparent" />',
                  '<param name="bgcolor" value="#ffffff" />',
                  '<embed src="', path, '"',
                  '  quality="high" scale="noscale" swLiveConnect="true" salign="lt"',
                  '  wmode="transparent" bgcolor="#ffffff"',
                  '  style="position;absolute; z-index;5"',
                  '  name="myFlash" align="middle" allowScriptAccess="always"',
                  '  allowFullScreen="false" type="application/x-shockwave-flash"',
                  '  pluginspage="http://www.macromedia.com/go/getflashplayer" />',
                  '</object>'];
              document.getElementById('someDiv').innerHTML = html.join('')
            }
            </script>
            

            Let me know if that helps. It could be some security stuff, too, but let's start with this... πŸ˜„

            • Scott Lininger
              SketchUp Software Engineer
              Have you visited the Ruby API Docs?
            1 Reply Last reply Reply Quote 0
            • T Offline
              tomasz
              last edited by

              @unknownuser said:

              Tomasz,

              Flash has worked for me in a ruby webdialog on the mac. We use it in the Get Photo Texture extension, for example.
              ...
              Let me know if that helps. It could be some security stuff, too, but let's start with this... πŸ˜„

              Scott,
              Here is how I use the Flash:

              <html xmlns="http://www.w3.org/1999/xhtml" xml;lang="en" lang="en">
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
              <title>SU2TH-MainDialog</title>
              <script language="javascript">AC_FL_RunContent = 0;</script>
              <script src="AC_RunActiveContent.js" language="javascript"></script>
              <script >
              	function getFlashMovie(movieName)
              	{
              		var isIE = navigator.appName.indexOf("Microsoft") != -1;
              		return (isIE) ? window[movieName] ; document[movieName];
              	}
               </script>
              
              </head>
              <body bgcolor="#000000" resize="no" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" scroll="no">
              
              <script language="javascript">
              	if (AC_FL_RunContent == 0) {
              		alert("This page requires AC_RunActiveContent.js.");
              	} else {
              		AC_FL_RunContent(
              			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
              			'width', '100%',
              			'height', '100%',
              			'src', 'main_menu',
              			'quality', 'high',
              			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
              			'play', 'true',
              			'loop', 'false',
              			'wmode', 'exact_fit',
              			'devicefont', 'false',
              			'id', 'main_menu',
              			'bgcolor', '#000000',
              			'name', 'main_menu',
              			'menu', 'false',
              			'allowFullScreen', 'true',
              			'allowScriptAccess','sameDomain',
              			'movie', 'main_menu'
              			); //end AC code
              	}
              </script>
              <noscript>
              
              <object classid="clsid;d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" 
              			width="100%" height="100%" id="main_menu">
              	<param name="allowScriptAccess" value="sameDomain" />
              	<param name="allowFullScreen" value="true" />
              	<param name="movie" value="main_menu.swf" /><param name="quality" value="high" />
              	<embed src="main_menu.swf" quality="high" bgcolor="#000000" width="100%" height="100%" name="main_menu" 
              			align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" 
              			pluginspage="http://www.macromedia.com/go/getflashplayer" />
              </object>
              
              </noscript>
              </body>
              </html>
              
              

              I have found it on Adobe site. I want the 'movie' to act as an active content so Flash talks to Ruby via JS.
              I remember there is a procedure inside 'AC_RunActiveContent.js' recognising browsers. I will check if it supports Safari. If I will fail fixing my own solution will try yours.

              Thanks for help
              Tomasz

              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

              1 Reply Last reply Reply Quote 0
              • T Offline
                tomasz
                last edited by

                I have tried Scott's solution, but it fails on Mac.
                I have attached a sample tool with a webdialog containing flash animation.


                WebDialog & Flash - fails on Mac

                Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                1 Reply Last reply Reply Quote 0
                • scottliningerS Offline
                  scottlininger
                  last edited by

                  Tomasz,

                  The problem isn't the flash at all. You just need to change this line...

                  @dlg.set_url html_path
                  

                  To this...

                  @dlg.set_file html_path
                  

                  The string that find_support_file returns is a file path, not a url. When I changed the line in your sample, I saw your Flash movie. πŸ˜„

                  • Scott Lininger
                    SketchUp Software Engineer
                    Have you visited the Ruby API Docs?
                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    tomasz
                    last edited by

                    It have worked fine under Windows πŸ˜„ so I though it would have on Mac.
                    Thanks Scott!

                    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tomasz
                      last edited by

                      My goal is to create a webdialog based on Adobe Flex. It allows easy GUI creation with built-in standard components and as a result creates a single SWF file.

                      I have found an example how to communicate between Flash & JS. It is easy then to connect the Flash to Ruby.

                      Unfortunately a ExternalInterface extension which communicates Flash & JS doesn't work on Mac. It does under Windows.

                      I have taken the code from :

                      http://adriansule.com/blog/2009/08/flash-and-javascript-communication/


                      FlashJS&MacOSX.zip

                      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tomasz
                        last edited by

                        I have tested the AS-JS connection with another example script and I am getting on Mac:

                        @unknownuser said:

                        SecurityError: Error #2060: Security sandbox violation:

                        I have added a parameter to the flash object:

                        <param name="allowscriptaccess" value="always" />
                        

                        but it didn't help.

                        Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                        1 Reply Last reply Reply Quote 0
                        • scottliningerS Offline
                          scottlininger
                          last edited by

                          Tomasz,

                          I know that this is possible. I'm doing it inside the Get Photo Textures dialog in SU 7.2. A flash movie sends data to JS and thereby to ruby. But it's a lot of code and I just haven't had time to figure out a minimal example.

                          It could be that I was using the old FSCommand bridge instead of ExternalInterface...

                          I'll take a look as soon as I can. In the meantime, if you're charging to get it working you might do some searching on FSCommand and see if that's a method that would suit your needs.

                          Are you doing all of this locally, or is there some web-hosted content involved?

                          • Scott Lininger
                            SketchUp Software Engineer
                            Have you visited the Ruby API Docs?
                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            tomasz
                            last edited by

                            @unknownuser said:

                            I'll take a look as soon as I can. In the meantime, if you're charging to get it working you might do some searching on FSCommand and see if that's a method that would suit your needs.

                            Thanks a lot Scott. I really appreciate it.
                            I have read that playing with FSCommand is much more complicated than ExternalInterface. I am glad anyway that it works on MAC.
                            Under Win External Interface works excellent.

                            @unknownuser said:

                            Are you doing all of this locally, or is there some web-hosted content involved?

                            Yes, I am doing all locally as in the last attached sample.

                            Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              @unknownuser said:

                              I know that this is possible. I'm doing it inside the Get Photo Textures dialog in SU 7.2.

                              ... point two? ❓

                              Thomas Thomassen β€” SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • scottliningerS Offline
                                scottlininger
                                last edited by

                                @thomthom said:

                                @unknownuser said:

                                I know that this is possible. I'm doing it inside the Get Photo Textures dialog in SU 7.2.

                                ... point two? ❓

                                Doh. Silly typo... I meant 7.1 πŸ˜‰

                                • Scott Lininger
                                  SketchUp Software Engineer
                                  Have you visited the Ruby API Docs?
                                1 Reply Last reply Reply Quote 0
                                • thomthomT Offline
                                  thomthom
                                  last edited by

                                  Awh. 😞

                                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                  List of my plugins and link to the CookieWare fund

                                  1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tomasz
                                    last edited by

                                    I would appreciate if someone on MAC could run this simple test.
                                    It is minimal example of JS<>Flash communication with all errors on flash side being reported.

                                    Maybe I have different security settings in Safari or something similar.

                                    I have also tried an old solution (prior to Flash 😎 called JavaScriptFlashGateway, but on Mac have received same message as in Win in a browser. In Win, inside SU sandbox, the FlashGateway worked fine.


                                    error_sample.png


                                    Minimal example with diagnostic

                                    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      tomasz
                                      last edited by

                                      @unknownuser said:

                                      In the meantime, if you're charging to get it working you might do some searching on FSCommand and see if that's a method that would suit your needs.

                                      No luck with FSCommand.
                                      I have tried several things: changing letters' case in 'allowScriptAccess', played with 'name' and 'id' parameters.
                                      It gives same security window or reports AS Error #2060.

                                      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                                      1 Reply Last reply Reply Quote 0
                                      • scottliningerS Offline
                                        scottlininger
                                        last edited by

                                        Thomasz,

                                        So I spent some time trying to get it to work, and I'm having similar problems on the Mac.

                                        I can get AS2 to work fine using FSCommand and SetVariable, but not AS3.

                                        I'll file a bug internally and try to learn some more. Keep me posted if you make any progress.

                                        • Scott Lininger
                                          SketchUp Software Engineer
                                          Have you visited the Ruby API Docs?
                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          tomasz
                                          last edited by

                                          I have added

                                          flash.system.Security.allowDomain("*")
                                          
                                          

                                          before

                                          ExternalInterface.addCallback
                                          

                                          in AS3 but it didn't help.
                                          Will look for another solution.

                                          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                                          1 Reply Last reply Reply Quote 0
                                          • honoluludesktopH Offline
                                            honoluludesktop
                                            last edited by

                                            Someday, no flash support for apple?

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement