Skip to main content
marioi86506991
Participating Frequently
March 22, 2016
Question

Javascript ist not working in Adobe Captivate 9

  • March 22, 2016
  • 1 reply
  • 561 views

Hello Together, i have created a JavaScript. If You execute the JavaScript You can see two eyes which follow the mousecursor.

If I save my JavaScript as a html-file. It works very well. But If I insert the JavaScript into Adobe Captivate9 it is not working.

Anybody ideas what the problem is?

Attached my Javascript:

<style>
#auge1  { font-family:"courier new"; font-size: 72pt; margin: 0px; position: absolute;}
#auge2  { font-family:"courier new"; font-size: 72pt; margin: 0px; position: absolute;}
#pupille1 { font-family:"courier new"; font-size: 36pt;  margin: 0px; position: absolute;}
#pupille2 { font-family:"courier new"; font-size: 36pt;  margin: 0px; position: absolute;}
</style>
<script>
var        auge=44;          //Höhe des Auges (entschricht 'o' bei 72pt)
var        pupille=6;        //Höhe der Pupille (entspricht '.' bei 36pt)
var        hoehe=20;        //Hoehe von oben
var        links=300;        //Anstand vom linken Rand
var        abstand=55;      //Abstand der Augen zueinander

function ausrichten()
{
document.all["auge1"].style.pixelLeft = links - auge/2 + pupille;
document.all["auge1"].style.pixelTop = hoehe - auge/2;
document.all["auge2"].style.pixelLeft = links + abstand - auge/2 + pupille;
document.all["auge2"].style.pixelTop = hoehe - auge/2;
}

function pupillen()
{
        document.all["pupille1"].style.pixelLeft = links                 + (auge/2 - pupille)         * Math.cos(Math.atan2(y-(hoehe ),x-(links)));
        document.all["pupille1"].style.pixelTop         = hoehe                 + (auge/2 - pupille)         * Math.cos(Math.atan2(x-(links ),y-(hoehe)));
        document.all["pupille2"].style.pixelLeft = links + abstand       + (auge/2 - pupille)  * Math.cos(Math.atan2(y-(hoehe),x-(links + abstand)));
        document.all["pupille2"].style.pixelTop         = hoehe                 + (auge/2 - pupille)         * Math.cos(Math.atan2(x-(links + abstand),y-(hoehe)));
}
var x,y;
function maus()
{
        x = window.event.x + document.body.scrollLeft - auge/2;
        y = window.event.y + document.body.scrollTop - auge;
        status = x + "    " + y;
        pupillen();
}

</script>
</head>
<body onload="ausrichten()" onmousemove="maus()">
<span id="pupille1" class="pupille1">.</span>
<span id="pupille2" class="pupille2">.</span>
<span id="auge1" class="auge1">o</span>
<span id="auge2" class="auge2">o</span>

Thanks!

    This topic has been closed for replies.

    1 reply

    TLCMediaDesign
    Inspiring
    March 22, 2016

    How are you inserting the script?

    Try zipping the HTML file and inserting as an HTML5 animation.

    marioi86506991
    Participating Frequently
    March 22, 2016

    With copy and paste

    TLCMediaDesign
    Inspiring
    March 22, 2016

    That's not going to work.

    You can't put html in the JS window.

    Plus, you are creating elements. Zip the file and insert as an HTML5 animation.