「Flash/代替/swf2js」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→インストール) |
(→指定したエレメントにロード) |
||
| (同じ利用者による、間の1版が非表示) | |||
| 行35: | 行35: | ||
swf2js.load("/swf/helloworld.swf", { tagId:"altContent", width: "750", height: "600"} ); | swf2js.load("/swf/helloworld.swf", { tagId:"altContent", width: "750", height: "600"} ); | ||
</script> | </script> | ||
| + | </pre> | ||
| + | |||
| + | ==FlashVarsを追加する場合== | ||
| + | <pre> | ||
| + | swf2js.load("/swf/helloworld.swf", {FlashVars: { | ||
| + | username: "taro", | ||
| + | age: 2, | ||
| + | }}); | ||
</pre> | </pre> | ||
2024年3月3日 (日) 11:33時点における最新版
swf2jsとは
swfファイルをhtml5で動作させるjsライブラリ
参考:https://twitter.com/TANAKA_U/status/1645457315401994242
参考:https://fedor-hidor.blog.jp/archives/21214199.html
ダウンロード
https://github.com/swf2js/swf2js
インストール
swf2js.jsだけを公開dirへupload
<html>
<body>
<head>
<script type="text/javascript" src="/js/swf2js.js"></script>
</head>
<body>
<script type="text/javascript">
swf2js.load("/swf/helloworld.swf");
</script>
</body>
</html>
指定したエレメントにロード
<center>
<div id="altContent">
<h1>example</h1>
</div>
</center>
<script type="text/javascript">
swf2js.load("/swf/helloworld.swf", { tagId:"altContent", width: "750", height: "600"} );
</script>
FlashVarsを追加する場合
swf2js.load("/swf/helloworld.swf", {FlashVars: {
username: "taro",
age: 2,
}});
