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

How to get URL Parameters into HTML Canvas?

Community Beginner ,
Oct 24, 2019 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

593

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
community guidelines
Participant ,
Oct 25, 2019 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.

Votes

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
community guidelines
LEGEND ,
Oct 25, 2019 Oct 25, 2019

Copy link to clipboard

Copied

LATEST

"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?

 

 

Votes

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
community guidelines