Flash CS5- "navigateToURL" in web-browser hosted on MySpace
I made a quick flash document for my friend who posted it his MySpace. The document has 3 buttons, each with a URL attached to them. When I play the SWF file locally, the links work fine, however once it's published to MySpace, the links refuse to work. The hand icon comes up so it understands them at least as buttons, but it seems to do nothing when clicked in the web-browser. Also, I can open the SWF in my browser and it also works fine.
I'm using Flash CS5 and working 开发者_运维知识库in ActionScript 3.0. The three buttons are on one layer called "Buttons". I right click the button and click "Actions". From there, I click the "Code Snippets" and under the folder "Actions" there is an item called "Click to Go To Webpage". Here is the code it gives you by default:
button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_6);
function fl_ClickToGoToWebPage_6(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");
}
I heard there was a problem with MySpace not allowing action scripts, and after checking the source code, the value is set to not allow action scripts. I don't think it's a browser issue, since it's working fine when I execute the SWF by itself, and when I load it into Firefox. It's just seems MySpace is having a problem with it.
On the "allowScriptAccess" param, try changing the value to "always"... I had the same problem on a Ning network and this fixed it. The same fix used to work on MySpace but I know they are constantly upgrading their security measures. Good luck!
Been looking at several messageboards online and they all seem to be saying the same thing - MySpace blocks those sorts of ActionScript commands.
I can't seem to find an official "we don't allow this" on MySpace's Developer site...but I'm pretty sure they have disabled a lot of stuff like that by this point.
[EDIT] This thread seems to have a good discussion on it with a possible solution in the last comment...but just don't be shocked if MySpace, Facebook, etc. block certain Flash functionality in general... http://developer.myspace.com/Community/forums/p/232/45799.aspx
精彩评论