12.4.07

allowNetworking
all | internal | none

Sweet


I recently created a widget for MySpace and other community sites. Some of these sites force the community posting flash widgets to set the object allowNetworking attribute to 'internal'. I needed to know ahead of time wether I could just provide a link or if I would need a button to allow the user to copy the destination to the clipboard.

I couldn't find a built in function to check the value ahead of time, but I noticed that when I tried to call navigateToUrl with this attribute set to 'internal' or 'none', Flex throws a SecurityError...

Cool, using this knowledge I created a simple function that tries to call navigateToUrl with an empty url. Flash won't try to go to '' (empty string) but navigateToUrl still throws the SecurityError. So my function uses a simple try/catch/finally to return true or false.

Check out the sample code here:

allowNetworking Sample

Let me know if AS3 provides other means for testing this value, I couldn't find one.

No comments: