Flash CS6 - SWF file to communicate with the internet - actionscript-3

I have dynamic text that loads from a txt file that is hosted on my site. When I play the swf file I get a Flash Player security error: myfile.swf is trying to communicate with the Internet-enabled location: myurl.com. To let this application communicate with the Internet click Settings.
Is there a way to give permissions to myurl.com within flash - not in the flash player settings?

Are you launch swf localy? No, there isn't another way to give permissions, only by adding the folder with swf file (or any parent folder or the hole disk partition) to the trusted locations in flash player settings panel.

Related

Database content not retrieved in the exported SWF and published HTML

I have this problem that when i am running my project in Flash cs6 using ctrl+enter, the project is ok, the flash player is retrieving the files from mysql database. but when i run the independent swf file outside, there is no retrieval happening. the text box that suppose to be showing the retrieved data is empty. how can i fix this?
Make sure you are running the published html from an actual page in the browser and not from the local file system.
Just make sure that the URL doesn't start with file:///
You must be having a security sandbox error, but you probably don't have the Debugger version of the Flash Player, so it's not telling you anything.
Just go to http://www.adobe.com/support/flashplayer/downloads.html and choose the proper one for your operating system and browser.
If you STILL want to run the files from your local file system, you can have a look at Flash Player's Global Configuration, to give access to the files/directories you want. Just right click on your swf file in the browser, and when the Menu opens, select Global Configuration.
The reason it is working when running inside Flash CS6 is that the player has less security restrictions in there.
Let me know if you were able to solve your problem.

Windows 8 store app HTML-Javascript Developing Music Player Application to play local music files

I am developing a Music Player application which plays local mp3 files from music player.
In my app there is an option to add mp3 files from music folder to the Playlist.
The problem I am facing is when I set local path of the mp3 file as source to Html 5 audio tag it throws an error.
Below is the code
audioPlayer.src = "C:\Users\Sharma\Music\JiveHD Songs";
I am using sqlite database to maintain playlist.
Can anyone help me on this.
So that I can play local mp3 files in my html5-javascript windows store app.
Have you selected the Music Library capability in your package.appxmanifest? You will need to select that for programmatic access to the user's music library. See http://msdn.microsoft.com/en-us/library/windows/apps/hh464936.aspx for more details.
Double-click the Package.appxmanifest file in Visual Studio, click the Capabilities tab, and make sure "Music Library" is checked.

is it possible to open external swf in new flash player with AS3 or AS2?

is it possible to open external swf in new flash player with AS3 or AS2? I've been searching everywhere for this, but most of what i found is that it's loading into new browser tab not other flash player.
There is no function to execute a new Flash Player.
If you think in this way: Flash Player is an executable in visitor's computer. If you can launch Flash Player, you can launch any executable you want. This causes security problem.
Therefore, you can't launch a new Flash Player.
fscommand(exec) only works with Windows Projector(exe) File, not SWF.

Load an image in flash/actionscript from a different origin domain

I'm a complete noob when it comes to flash coding.
I have a flash swf file that I'm loading from an S3 assets bucket. Inside the flash swf it should be displaying a "Browse" button, images also courtesy of the same bucket. This works fine when I host the images and swf file from the same domain that the site is on, but not when loaded from S3.
I have added a crossdomain.xml file to the assets bucket as follows (I'm trying with '*' to start just to get it working, and will narrow it down to my actual host when it appears to be doing anything):
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
I also have a cross-origin resource sharing configuration in the bucket so that the fonts will correctly load for our stylesheets (This is working).
What am I doing wrong to make the button images load in the actionscript? Do I need to modify the actionscript code itself? The code is located here (public library anyone can use, not authored by me): s3-swf-upload-plugin
You can see here that it is instantiating a new browseButton defined here. Like I said I'm not totally familiar with actionscript but believe I could fumble through it if someone could show me what's going wrong :) What's a good way to get actual error reporting? Firebug in Firefox and Chrome's console don't have any kind of messages from Flash about errors going on.
EDIT:
There were some quirkinesses going on in the setting up of the flash object and setting the paths for the button images. I updated BrowseButton.as to do this:
Security.loadPolicyFile("http://s3.amazonaws.com/my-bucket/crossdomain.xml");
I placed this before any of the URLRequest calls in the BrowseButton() function. However it's still not displaying the images :( I also hardcoded the values in the URLRequest to be things like:
upLoader.load(new URLRequest("http://s3.amazonaws.com/my-bucket/assets/s3_up_button.gif"));
but nothing seems to happen. When I set it to /assets/s3_up_button.gif to pull from the local file then it works fine. What am I doing wrong! How can I get error messages displaying from the flash video? :\ I compiled with <debug>true</debug> but I'm not sure how to get actual exception messages.
Check what sandbox your swf is in:
The Security.sandboxType property
An author of a SWF file can use the read-only static
Security.sandboxType property to determine the type of sandbox to
which Flash Player has assigned the SWF file. The Security class
includes constants that represent possible values of the
Security.sandboxType property, as follows:
Security.REMOTE--The SWF file is from an Internet URL, and operates under domain-based sandbox rules.
Security.LOCAL_WITH_FILE--The SWF file is a local file, but it has not been trusted by the user and was not published with a networking designation. The SWF file can read from local data sources but cannot communicate with the Internet.
Security.LOCAL_WITH_NETWORK--The SWF file is a local file and has not been trusted by the user, but it was published with a networking designation. The SWF can communicate with the Internet but cannot read from local data sources.
Security.LOCAL_TRUSTED--The SWF file is a local file and has been trusted by the user, using either the Settings Manager or a Flash Player trust configuration file. The SWF file can both read from local data sources and communicate with the Internet.
You probably want Security.LOCAL_WITH_NETWORK, although Security.LOCAL_TRUSTED will also work.
An explanation, along with details of how to set the sandbox in Flex, is here: http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_04.html
If you're working in the Flash IDE, it should just be part of the publish settings.

When I zip up my demo FlashDevelop project..why does it break?

I built an AS3 image gallery using FlashDevelop.
Before I zip up the application, I can run the image gallery in my browser by simply opening the index.html for the project. Everything works perfectly.
I then zip up the project as proj-0.1.2.zip using winrar.
I then unzip this newly created zip and try to load the application using the project index.html like above. The gallery doesn't function properly. From seeing what happens, it appears as though the image metadata is not present(but I'm not sure, see below).
There are other applications as well that are broken. Videos don't load. If an application doesn't depend on any external assets then everything looks fine.
Another thing..If I then build the FlashDevelop project and republish the swf..then it works in the index.html like I want. What is going on here?
I want people to be able to fire up my demo apps out of the box by just running the index.html. If that doesn't always work and they have to figure out that they need to rebuild the SWF then that's pretty bad.
I don't think zipping is the problem, I think moving to a different folder is a problem.
I assume you are running this index.html on your local PC, and not on a webserver?
By default, Flash cannot access from a local SWF to load other local files. However, FlashDevelop / Flash CS3 / Flex Builder, in order to get around this restriction, set some flags in the flash player telling him "This SWF is a trusted SWF, allow him to open local files". But it's based on the exact location of the SWF.
There's a setting somewhere in the compiler, that sets a flag in the SWF saying "This SWF can access local data", but there's one downside: It blocks all access to network resources. So it's either/or: access local data, OR access network resources (anything that goes over HTTP, Socket, etc). I'm not sure where this setting is offhand. It may be that the default setting for Flash CS3 is different than the default setting for FlashDevelop.
Anyway, the easy way to avoid all this issue is to not run the file locally. Put it on your webserver before testing.