Highlighted

How to get URL Parameters into HTML Canvas?

Community Beginner ,
Oct 24, 2019

Copy link to clipboard

Copied

Here's a javascript function that reads the URL parameters and makes them usable for javascript.  How can I adapt this for use inside a HMTL Canvas in Adobe Animate?  I have tried unsuccessfully.

 

function GetURLParameter(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];
        }
    }
}​

// Retrieve Parameters and set Variables
var lab = GetURLParameter('lab');
var sec = GetURLParameter('sec');

 

 

Help much appreciated. I'm new to Animate, and have been searching for the solution.

Cheers,

Geoff

 

TOPICS
Code

Views

128

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to get URL Parameters into HTML Canvas?

Community Beginner ,
Oct 24, 2019

Copy link to clipboard

Copied

Here's a javascript function that reads the URL parameters and makes them usable for javascript.  How can I adapt this for use inside a HMTL Canvas in Adobe Animate?  I have tried unsuccessfully.

 

function GetURLParameter(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];
        }
    }
}​

// Retrieve Parameters and set Variables
var lab = GetURLParameter('lab');
var sec = GetURLParameter('sec');

 

 

Help much appreciated. I'm new to Animate, and have been searching for the solution.

Cheers,

Geoff

 

TOPICS
Code

Views

129

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 24, 2019 0
Participant ,
Oct 25, 2019

Copy link to clipboard

Copied

Hi Geoff

 

I've attached an FLA that shows how your code can be used to populate a dynamic text box with URL parameters in Animate HTML5.

 

Hope it helps!  Let me know if you have any questions.

 

FLA in zip file.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 25, 2019 0
ClayUUID LATEST
Adobe Community Professional ,
Oct 25, 2019

Copy link to clipboard

Copied

"I have tried unsuccessfully" is a completely useless statement for troubleshooting. Have you checked the browser's dev console for errors? Is the function even running? Is it crashing? Is it returning the wrong values? Unexpected values? Any values at all?

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 25, 2019 0