HTML5 & JavaScript

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
conver
Posts: 2
Joined: Sat Nov 21, 2020 7:19 pm

HTML5 & JavaScript

Post by conver »

Hello guys!

I spent a lot of time to figure out how to use VarSet function for my Lvar.
Since I have no results and spent too much time already I need your help...
Variable : L:MyVar,number
How to set value for L:MyVar,number using JavaScript VarSet ?

Something like?

Code: Select all

<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">

<h2>JavaScript Variables</h2>

<p>Set/Read a variable and display it:</p>

<p id="value"></p>

<script>
    function loop(timestamp)
    {
		
	VarSet("L:MyVar","number",5);
		
        var value = VarGet("L:MyVar", "number");
        document.getElementById('value').innerHTML = value;

        window.requestAnimationFrame(loop);
		
    }

    window.requestAnimationFrame(loop);
</script>

</body>
</html>
Post Reply