Mac WebDialog & Flash
-
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 foundset_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"]
-
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...
-
@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 -
I have tried Scott's solution, but it fails on Mac.
I have attached a sample tool with a webdialog containing flash animation.
-
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.
-
It have worked fine under Windows so I though it would have on Mac.
Thanks Scott! -
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/
-
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.
-
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?
-
@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.
-
@unknownuser said:
I know that this is possible. I'm doing it inside the Get Photo Textures dialog in SU 7.2.
... point two?
-
@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
-
Awh.
-
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.
-
@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. -
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.
-
I have added
flash.system.Security.allowDomain("*")
before
ExternalInterface.addCallback
in AS3 but it didn't help.
Will look for another solution. -
Someday, no flash support for apple?
-
@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.
-
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,
Advertisement