Groups | Blog | Home
all groups > flash actionscript > september 2005 >

flash actionscript : Error trying to pass javascript variable


karma-lab
9/10/2005 5:34:25 PM
I've been trying to pass a javascript variable to my swf using the methods
explained in this technote:


http://www.macromedia.com/cfusion/knowledgebase/index.cfm?event=view&id=KC.tn_15
683&extid=tn_15683&dialogID=62708134&iterationID=1&sessionID=9630e42f1a202c581d2
9&stateID=0+0+15103487&mode=simple

I have this function defined:

<script language = JavaScript>
<!--
function PassFlash(){
window.document.myFlash.SetVariable("text", "hello");
}
//-->
</script>

My movie is named myFlash.swf, my document is myFlash.html, etc. I set all the
EMBED tags as described.

I have a URL on the html page to call PassFlash() when it is clicked.

When I do so, I get this error message (in Opera, for example):

name: TypeError
message: Statement on line 4: Expression did not evaluate
to a function object: window.document.myFlash.SetVariable

Any ideas what I'm doing wrong?
NSurveyor
9/10/2005 5:46:06 PM
Try:

<script language = JavaScript>
<!--
function PassFlash(){
document.getElementById("myFlash").SetVariable("text", "hello");
}
//-->
</script>
karma-lab
9/10/2005 6:17:24 PM
Thanks for the reply.

I tried it, and I get the same error message, about the new function:

name: TypeError
message: Statement on line 4: Expression did not evaluate
to a function object: document.getElementById("myFlash").SetVariable


karma-lab
9/10/2005 6:55:36 PM
Actually, it appears that the problem is on the Mac only. (OS X 10.3.9)

It works fine on Windows.

Even the example supplied by MacroMedia in the link at the top doesn't work on
Mac OS X (Opera, Safari, etc.)

Anybody know if there's a workaround?
unthinkMedia
10/14/2005 6:57:34 PM
I used sharedObjects as a work around a long time ago. I had a one pixel movie
which i loaded and passed a shared Obj to the main movie which held a listener.
That seemed to work on all browsers and platforms, but i want a better
non-hacked together solution.
AddThis Social Bookmark Button