sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Mac WebDialog & Flash

    Scheduled Pinned Locked Moved Developers' Forum
    24 Posts 5 Posters 4.4k 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

      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
                              • T Offline
                                tomasz
                                last edited by

                                @unknownuser said:

                                I'll file a bug internally and try to learn some more.

                                Have you or the Team found a remedy for the AS3 issue? I want to develop an UI in Flash and want to know if it will be worth investing time in it. If it won't run on MAC I have to look for a different solution.

                                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,

                                  Unfortunately, we do not have a solution at this time, and I can't predict how long it might be before we do.

                                  Thank you so much for all your help in identifying and tracking down this problem! I wish I had a simple solution.

                                  One idea, if you're in the mood for exploring some more, might be to see if AS3 could communicate with javascript via URL fragment identifier, like myFlashpage.html#some_custom_data. You may be able to set/get data via that string after the #.

                                  A related idea might be to see if you can set the URL of a hidden iframe via flash and have JS read that URL to pull out some encoded data.

                                  Cheers,

                                  • 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

                                    @unknownuser said:

                                    One idea, if you're in the mood for exploring some more, might be to see if AS3 could communicate with javascript via URL fragment identifier, like myFlashpage.html#some_custom_data. You may be able to set/get data via that string after the #.

                                    Like AJAX solutions often do?

                                    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:

                                      Like AJAX solutions often do?

                                      This approach is most often used for "inter-frame" communication. If there are 2 frames in a page that are hosted on different domains, the JS in one is not allowed to access the other, but many browsers allow you to change the fragment identifier regardless of security, so it might work in this case. (There are a handful of other mechanisms people have used to get around frame-2-frame security, and any of them might work. Searching on the topic might give us a clever workaround.)

                                      Ajax apps will often modify the fragment to maintain state in the URL, so you can still email URLs around and have your friends land on the same "page" inside an Ajax app.

                                      • Scott Lininger
                                        SketchUp Software Engineer
                                        Have you visited the Ruby API Docs?
                                      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