Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing params to the SWF #4

Open
nicksterious opened this issue May 12, 2023 · 0 comments
Open

Passing params to the SWF #4

nicksterious opened this issue May 12, 2023 · 0 comments

Comments

@nicksterious
Copy link

nicksterious commented May 12, 2023

I have a SWF that tries loading something from the server but needs a param with a relative path to load from, something I'd pass as:

<param name="base" value="/my/relative/path/data.txt" />

Without this parameter it will always try loading from the browser URL, eg:
https://www.example.com/play-game/my-game-name,

... despite the SWF being at /my/relative/path/.

My code:


<script src="/awayfl/loader.js"></script>
<script>
	const config = {
		width: 800,
		height: 600,
		splash: '/awayfl/splash.png',
		progress: { // optional
			back: 'cover url(/awayfl/progressBack.png)',
			line: #cc0022, // or image, it will passed to progressLine background,
			rect: [0, 0.9, 1, 0.1] // x, y, width, height of preogress line relative contianer 
		},
		baseUrl: '/awayfl/',
		runtime: ['/awayfl/runtime.js'],
		binary: [{
			path: '/my/relative/path/example.swf',
			resourceType: 'GAME',
			name: 'Game', // not used atm
			meta: {} // not used atm
		}],
	};
	//window.addEventListener("load", () => {
		AWAYFL.LegacyLoader.init(config);
		AWAYFL.LegacyLoader.runGame((fill) => {
			window.dispatchEvent(new CustomEvent('awayfl-player-progress', {detail: fill}));
		}, (config, hideLoader) => {
			const player = new AWAYFL.Player(document, config);
			window.dispatchEvent(new CustomEvent('awayfl-player-init', {detail: player}));
			player
				.loadAndPlay()
				.then((_, hide) => {
					window.dispatchEvent(new CustomEvent('awayfl-player-load'));
					hide && hide();
				});				
		});
	//});
</script>

Now this is just an example of a parameter, I understand there are redirects we can use for this particular situation.

How about other parameters that configure the asset?

How do I pass parameters to SWF files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant