Hello,
In flash would be…
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters.username;
and in the container HTML
<param name="FlashVars" value="username=test" />
thanks
Hello,
In flash would be…
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters.username;
and in the container HTML
<param name="FlashVars" value="username=test" />
thanks
In a SWFObject embed, you would pass the flashvars as an object. We support the same paradigm on HTML5, but instead of another argument in the embed, it is an object of the window configuration you can pass.
The default template already has a parameters: {}
object, you should be able to add values to this, such as parameters: { username: "test" }
https://github.com/openfl/openfl/blob/develop/templates/html5/template/index.html#L51
In order to override our default “index.html” template, create a template directory somewhere. I’ll call it “path/to/templates”.
Then in your project.xml, add your template path (after <haxelib name="openfl" />
to add your template path. They resolved like class paths, so if your template path includes “html5/template/index.html” our tools will use your version of the file rather than the OpenFL or Lime version. Then copy the same directory structure as the OpenFL or Lime “templates” directory for any files you want to override. In this case, copy the “templates/html5/template/index.html” file to your own “html5/template” directory, then make the changes you want for extra “flashvars”
<template path="path/to/templates" />
I have this error
Unable to get property 'get_loaderInfo' of undefined or null reference
when I use stage.loaderInfo
stage
is null
if your display object is not on the display list, yet. The Main
or entry class for OpenFL projects is automatically added to the stage, but other classes will have to (normally) wait until after Event.ADDED_TO_STAGE
in order to get a stage
reference.
I say normally because Haxe adds an extra static reference to the stage
that doesn’t exist in plain AS3:
openfl.Lib.current.stage
This should always be defined