开发者

Navigating to URL from within SWF inside Facebook app

I am trying to let the user exit a flash application inside Facebook to go to a youtube video page on a MouseClick

_storyVO.youtubeid is the youtube ID, it works fine locally.

So far I have tried:

placing the TextField inside a Sprite and add adding a MouseEvent.CLICK listener that calls:

navigateToURL(new URLRequest("http://www.youtube.com/watch?v=" + _storyVO.youtubeid), "_self");

or

navigateToURL(new URLRequest("http://www.youtube.com/watch?v=" + _storyVO.youtubeid), "_blank");

both fail with a security warning.

using htmlText in the TextField like:

textField.htmlText = "<a href='http://www.youtube.com/watch?v=" + _sto开发者_JAVA技巧ryVO.youtubeid + "'>watch on youtube</a>";

-> also fails with a security warning.

  • as well as calling a JavaScript Function using the FBJSBridgeUtil Class and inside the JS-Function is a 'window.location.href' which, as it turns out, also does not work.

Any help will be appreciated, dirty hacks as well. Thanks.


It turns out that using a TextField with htmlText and an a-href using target '_blank' works fine:

textField.htmlText = "<a href='http://www.youtube.com/watch?v=" + _storyVO.youtubeid + "' target='_blank'>watch on youtube</a>";

and in the cases where I need it to be a button, i simply created a textField with random text and the desired a href in it, to match the height of the button, put it on top of it with alpha=0 and background=true to have a nice rectangular clicking area that works within facebook:

textField.background = true;
textField.htmlText = "<a href='" +_storyVO.tweetLink + "' target='_blank'>RANDOM</a>";
textField.x = button.x;
textField.y = button.y;
textField.alpha = 0;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜