Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript ist not working in Adobe Captivate 9

New Here ,
Mar 22, 2016 Mar 22, 2016

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!

443
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 22, 2016 Mar 22, 2016

How are you inserting the script?

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2016 Mar 22, 2016

With copy and paste

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 22, 2016 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2016 Mar 22, 2016

Thank You, ist working well.

But now I have the Problem that i can´t push the button which I have created bevor to continue to the next page.

How can I solve this problem`?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 22, 2016 Mar 22, 2016

put window.parent. in front of the JavaScript command. Something like:

window.parent.window.cpAPIInterface.next();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2016 Mar 22, 2016

Can You Show me where I have exactly insert "window.parent.window.cpAPIInterface.next();"

inside my JavaScript above?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 22, 2016 Mar 22, 2016
LATEST

You said: "But now I have the Problem that i can´t push the button which I have created bevor to continue to the next page."

Where is this button?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources