Closed GoogleCodeExporter closed 9 years ago
If I copy-paste that code from where it originally was (in
app/views/flex/index.html, while the main app is in
app/flex, not app/views...), then it works! But that doesn't solve my problem
because I need it where it was...
What might this be? Changing it from "app/views/flex/index.html" to
"bin-debug/MyProject.html" made it
work, even with the Run/Debug settings changed as described above.
Is this a bug or is there a solution?
Original comment by lanceJpo...@gmail.com
on 2 Dec 2009 at 12:10
Hi!
Can you create test project and post it?
Original comment by burd...@gmail.com
on 2 Dec 2009 at 12:13
It's a bit too complicated to post a test... It's a Rails project with lots of
dependencies on other libraries and
I'm not sure you have all that set up. If you do, I'll send it over.
My question is, how does jsinterface integrate with swfobject, and does
swfaddress compete with it for
methods? What methods/properties/overrides are they (jsinterface/swfobject)
relating on? And second, what
is happening when I change the Run/Debug settings? Is JSInterface dependent on
a specific Run/Debug
setting in Flex? How can I start debugging the javascript to see if it's
interacting with jsinterface properly?
My project is working fine with the way all the settings are, and with the
index.html file being dynamically
generated from rails. How/where is JSInterface interacting with this? It
seems like it should just work but I
must be missing something. What are some things I might be missing?
Thanks so much for your help.
Lance
Original comment by lanceJpo...@gmail.com
on 2 Dec 2009 at 12:27
Can you select only JSInerface code for test?
> My question is, how does jsinterface integrate with swfobject,
> and does swfaddress compete with it for methods? What methods/properties/
> overrides are they (jsinterface/swfobject) relating on?
JSInterface did not interact, and in no way connected with SWFObject and
SWFAddress.
Ofcourse if you did not this interaction by yourself. Firstly you need to look
into
generated HTML and verify is ID correctly added to all <object> tags.
> And second, what is happening when I change the Run/Debug settings? Is
> JSInterface dependent on a specific Run/Debug setting in Flex?
No, JSInterface only need to be run under HTTP to work as expected. If you will
run
it locally, Browser can disable interaction.
> How can I start debugging the javascript to see if it's interacting
> with jsinterface properly?
Try JSInterface debug properties:
JSInterface.redirectJavaScriptExceptions
JSInterface.traceExceptionOnly
JSInterface.exceptionHandler
JSInterface.redirectFlashExceptions
Read ASDoc for more info. For example, if you need to debug JavaScript in
FireBug
for example, try
JSInterface.redirectJavaScriptExceptions = false;
Original comment by burd...@gmail.com
on 2 Dec 2009 at 12:43
what is that <object> and ID part? What exactly do I need to make sure is
happening?
Thanks for the info on the exception redirects. I'll try that out.
Original comment by lanceJpo...@gmail.com
on 2 Dec 2009 at 12:48
<object> & <embed> - tags generated with SWFObject to show flash movie on HTML
page.
All such tags generated by SWFObject need to have ID attribute with the same
value.
this ID will be used by JSInterface to detect DOM object of current Flash
player to
do two sided interaction.
If HTML code have no ID, JSInterface can use Flash movie URL to find that DOM
object. More about that you can read in ASDoc of JSInerface.initialize() method
and
in documentation.
Original comment by burd...@gmail.com
on 2 Dec 2009 at 12:58
Here is the generated HTML:
<html>
<head>
<link rel="stylesheet" type="text/css" href="history/history.css" />
<title>Joseph Jewell</title>
<!--
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<style>
body { margin:0; padding:0; text-align:center; }
#flashContent { margin:0px auto; width:100%; text-align:left; }
</style>
<link rel="shortcut icon" href="/favicon.ico" /><!-- added! -->
<script type="text/javascript" src="javascripts/swfobject.js"></script>
<script type="text/javascript" src="javascripts/history/history.js"></script>
<script type="text/javascript" src="javascripts/swfaddress.js"></script>
<script type="text/javascript">
//<![CDATA[
swfobject.embedSWF('/bin-
debug/MyProject.swf','flashContent','100%','100%','9.0.0','/expressInstall.swf',
{"session_token":"a9f776257d2a
e34b83cf5071c9e99c90","authenticity_token":"8Z\/rHaezSTJwp6LVmpAgNOMMPlGn45SJy\/
SswJqC5AA="},{"b
gcolor":"#f0aaaa","menu":false,"allowFullscreen":true,"allowScriptAccess":"sameD
omain"},{"id":"MyProject"})
//]]>
</script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
</script>
<div id="flashContent">
<p><a href="http://www.adobe.com/go/getflashplayer"><img
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash
player" /></a></p>
</div>
</body>
</html>
It doesn't look like the object/embed tags are there. Is this correct? I
think this looks just like your
JSInterfaceSWObjectTest example. I've read through most of your code these
past few weeks, but I still don't
see where this problem is. Any other thoughts?
Original comment by lanceJpo...@gmail.com
on 2 Dec 2009 at 1:09
If I add this in actionscript:
protected function addEventListenerTest():void{
this._originalAddEventListener =
JSDynamic.convertFunctionToObject(JSInterface.window.addEventListener);
JSInterface.window.addEventListener = this.javaScriptAddEventListener;
}
protected var _originalAddEventListener:JSDynamic;
protected function javaScriptAddEventListener(...args):void{
trace('addEventListener: '+args);
this._originalAddEventListener.apply(JSInterface.window, args);
}
.. it traces out this:
{JavaScript} Undefined value
Target object: [[object Object]] property: [addEventListener]
Stack trace: null
{JavaScript} Undefined value
Target object: [[object Object]] property: [addEventListener]
Stack trace: null
Original comment by lanceJpo...@gmail.com
on 2 Dec 2009 at 1:15
Alright :). I boiled it down to a very basic project. It has a swfobject.js
file, a very basic html file, and a simple
flex application. It traces out the same null results and doesn't hear events.
It must be how
swfobject/jsinterface interact. Any thoughts?
Original comment by lanceJpo...@gmail.com
on 2 Dec 2009 at 2:17
Attachments:
Still haven't resolved the issue. Have you verified that this doesn't work?
Original comment by lanceJpo...@gmail.com
on 3 Dec 2009 at 6:23
When I run it in FireFox, the trace'd output is:
[SWF] Users:Lance:Documents:Flex Builder 3:examples:swfobject_jsinterface:bin-
debug:SwfobjectJsinterface.swf - 1,923,633 bytes after decompression
{JavaScript} m is undefined
Target object: [[object Object]] property: [addEventListener]
Stack trace: ("resize",(function () {var a = arguments;var c = a.callee;var m =
c._jsi.main;return
m[JSICallbacks.callbackMethod](c._jsi.getInfo(this), c._n,
JSI.convertListToInfoIn(c._jsi,
a));}))@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsin
terface/bin-
debug/SwfobjectJsinterface.html:0
([object XPCCrossOriginWrapper],"addEventListener",[object
Array])@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsin
terface/bin-
debug/SwfobjectJsinterface.html:0
([object XPCCrossOriginWrapper],"addEventListener",[object
Array])@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsin
terface/bin-
debug/SwfobjectJsinterface.html:0
([object Object],[object XPCCrossOriginWrapper],"addEventListener",[object
Array])@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsin
terface/bin-
debug/SwfobjectJsinterface.html:0
("__jsi_0","jo0","object","addEventListener",[object
Array])@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsin
terface/bin-
debug/SwfobjectJsinterface.html:0
("__jsi_0","jo0","object","addEventListener",[object
Array])@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsin
terface/bin-
debug/SwfobjectJsinterface.html:0
@file:///Users/Lance/Documents/Flex%20Builder%203/examples/swfobject_jsinterface
/bin-
debug/SwfobjectJsinterface.html:0
Original comment by lanceJpo...@gmail.com
on 3 Dec 2009 at 6:30
Original comment by burd...@gmail.com
on 4 Dec 2009 at 9:40
file:///Users/Lance/Documents....
btw, do not run JSInterface applications locally, only over HTTP.
Original comment by burd...@gmail.com
on 4 Dec 2009 at 11:20
It seems to work identically either way. This sample project works locally,
but I get the same errors in that Rails
project I was describing, which is over HTTP.
Original comment by lanceJpo...@gmail.com
on 4 Dec 2009 at 11:34
1. try to setup name and id with SWFObject:
var params = {
name:"flashId"
};
var attributes = {
name:"flashId"
id:"flashId"
};
2. trace generated HTML
trace(JSInterface.main);
trace(JSInterface.getElementsByTagName('body')[0].innerHTML);
trace(JSInterface.main.parentNode.innerHTML);
3. I have found error in your test code:
JSInterface.window.addEventListener("resize",
function(e:*):void
{
trace(e);
});
you forgot to add third argument. In new version of JSInterface 2.4.4 i have
changed
error format, so now you will see what exactly is wrong.
Original comment by burd...@gmail.com
on 4 Dec 2009 at 11:47
Generated HTML is:
<object type="application/x-shockwave-flash" id="flashId" name="flashId"
align="middle"
data="SwfobjectJsinterface.swf" width="100%" height="100%"><param
name="quality" value="high"><param
name="bgcolor" value="#aaddaa"><param name="allowscriptaccess"
value="sameDomain"><param
name="allowfullscreen" value="true"><param name="name" value="flashId"></object>
<noscript></noscript>
Original comment by lanceJpo...@gmail.com
on 5 Dec 2009 at 10:08
Original issue reported on code.google.com by
lanceJpo...@gmail.com
on 2 Dec 2009 at 12:01