> On Mar 7, 2018, at 5:35 AM, doug777 <[email protected]> wrote:
>
> I have almost finished converting my old Flex browser app to FlexJS (js
> only), but I have 4 problems left that I can't find a way to convert. Can
> anyone help to suggest a way to go with these items?
>
> 1. Application.parameters - I need to pass variables into the app on
> creation.
Here’s how I do it:
I have the following markup in the html template I’m using for my app:
My main application class has a parameter setter which does the “right” thing
with the parameters (very similar to how it works in Flex).
<body>
<script type="text/javascript">
function queryURL() {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
var query_string = {};
var query = window.location.search.substring(1);
if(!query){return {};}
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
query_string[pair[0]] = decodeURIComponent(pair[1]);
}
return query_string;
}
var app = new MyRoyaleApp();
app.parameters = queryURL();
app.start();
</script>
</body>