x


Browser to webplayer communication problem

Hi, I'm trying to send a string to my unity web player but I can't get it to work. I'm strictly following a couple of tutorials. Here's my code:

HTML:

        <script type="text/javascript" language="javascript">
 <!--
 function initValues()
 {    
 var unity = GetUnity();
 unity.first.SendMessage("BCMenu", "initVals", "Hello!");
 document.title="CENAÇA";
 }
 window.onload = initValues;
 -->
 </script>

Unity script:

           function initVals (param : String) 
           {
             GUI.Label(Rect(10,50,150,20),param);
           }

I got my webplayer page running on the localhost serverand I'm running it with Mozilla Firefox and Google Chrome. The target object and script I'm trying to interact have the same name "BCMenu" and the function is named "initVals".

Can someone figure what am I doing wrong?

Thanks in advance.

more ▼

asked Jul 17 '12 at 06:55 PM

skitch gravatar image

skitch
15 3 6 9

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x810
x126

asked: Jul 17 '12 at 06:55 PM

Seen: 297 times

Last Updated: Jul 17 '12 at 06:55 PM