他のページを開くシールの hack.js は次のようになっています。
- location.replace("page://JTwZfnMf1375585755864");
location.replace("page://JTwZfnMf1375585755864");
また、web ページを開く hack.js は次のようになっています。
- location.replace("https://maps.google.co.jp/");
location.replace("https://maps.google.co.jp/");
どうもタップすると hack.js が実行されるようです。
そこで、hack.js を次のようにしてシールをタップすると問題なくアラートがでてきます。
- importJS(["lib/MOON.js"], function() {
- MOON.alert('Hello MOON', function() {
- MOON.finish();
- });
- });
importJS(["lib/MOON.js"], function() {
MOON.alert('Hello MOON', function() {
MOON.finish();
});
});
しかし、次のようにしてシールをタップすると、ペンの太さは変わるのですが「シールの実行に失敗しました InvalidScript」と言われます。
- importJS(["lib/MOON.js"], function() {
- MOON.setPenWidth(5.0);
- MOON.finish();
- });
importJS(["lib/MOON.js"], function() {
MOON.setPenWidth(5.0);
MOON.finish();
});
次のように Sticker オブジェクトを使うようにすると「InvalidScript」が出なくなります。
- importJS(["lib/MOON.js"], function() {
- var sticker = Sticker.create();
- sticker.ontap = function() {
- MOON.setPenWidth(5.0);
- MOON.finish();
- };
- sticker.onattach = function() {
- MOON.finish();
- };
- sticker.ondetach = function() {
- MOON.finish();
- };
- sticker.register();
- });
importJS(["lib/MOON.js"], function() {
var sticker = Sticker.create();
sticker.ontap = function() {
MOON.setPenWidth(5.0);
MOON.finish();
};
sticker.onattach = function() {
MOON.finish();
};
sticker.ondetach = function() {
MOON.finish();
};
sticker.register();
});
0 件のコメント:
コメントを投稿