Forum Moderators: open

Message Too Old, No Replies

Passing variables from flash to javascript

It works within the same domain, but not across domains

         

cameraguy

2:21 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



I have been using this technique and it works great when all the files are in the same domain. But in my particular case, I need to call a swf which is not on the same domain. Interestingly, the variables are not passed. I was wondering if you have a solution?

Here is what I am doing:

On the client website (client_domain.com/client_blog.htm)


<div id="flashid" style="width:220px; height:100px">
<script type="text/javascript">counter_id="40238";</script>
<script type="text/javascript" src="http://my_domain.com/flash_resize.js"></script>
</div>

'flash_resize.js' then calls the swf : my_domain.net/counter.swf

'counter.swf' then passes the variable back (size of stage):


getURL("javascript:setFlashHeight('flashid',"+h+");");

As I said before, it all works well if everything is on the same domain (either on 'my_domain.com' or on 'client_domain.com'), but not when there are two different domains...

I hope someone can help me out. I have been stuck with this for a while and I like this solution very much.

Thanks

cameraguy

4:07 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



Hurray! I found the reason. Since the version 8, Flash has an additional security that causes this problem. Passing the following parameter solves it:

<param name="allowScriptAccess" value="always">

Just FYI...