Can anyone please describe what is the flash pipeline when looking for crossdomain.xml file?
I am sometimes receive SECURITY_ERROR (#2700) from flash.
Trying to find the issue, I'd like to understand better the crossdomain loading pipeline.
I mean, Does it looks first in cached files in my browser? What does it do when going to server?
For example, I thought about such solution:
I'll put the link resources into html page Head section to download crossdomain before I am loading my flash object
In case of failure - I'll try to handle this from JS and notify server (somehow, not the issue)
But if the file was downloaded during html page loading - does it ensure me that flash will be able to load it? (may be from cached documents?)
I am completely-unfamiliar with this domain, so any help will be more than appreciated!
Related
We created a simple Flash animation that reads from an XML file in another server. This XML file has tags with the path of several images that will be displayed in the Flash. The xml tag looks like this:
<image_name><![CDATA[assets/images/image1.jpg]]></image_name>
When I tested locally I realized that, even after I changed the image in the XML, the SWF was still showing the image from the browser cache. So the developer ended up adding some random function so that the cache would not be an issue. That fixed the issue.
Unfortunately, the webhost that will publish the SWF tells me that they can't upload the SWF because the system doesn't allow SWF files that use random functions. So I can remove it and resubmit, but then the problem with the cache will be there.
Is there another alternative?
Thanks.
Preventing caching at all isn't a good idea in general, it's very useful feature that safes server traffic and decrease swf loading time.
Some of the solutions here can be to change URL in the xml config by adding version of the image manually:
<image_name><![CDATA[assets/images/image1.jpg?image_v1]]></image_name>
or generate this version automatically with script as md5 of the image bytes:
<image_name><![CDATA[assets/images/image1.jpg?5d41402abc4b2a76b9719d911017c592]]></image_name>
but it's required much more setup work.
Or add the version of the swf application:
<image_name><![CDATA[assets/images/image1.jpg?app_v1]]></image_name>
the last solution is a compromise between two options - maintaining version of each image file and removing cache at all. In this case you have to maintain only the version of swf file, but you have to update it each time you change some of the images.
Preventing cache isn't good, but here is my solution: use a "random" number (current time in seconds) as a param assets/images/image1.jpg?t=RandomNumber.
I have a simple flash activity that loads its text from an external file called QA.txt using the URLLoader function. I wanted to convert this file to html5 using Google Swiffy, which I have done, expect it doesn't seem to be loading the QA.txt file anymore. I believe it says this functionality is supported on their main website, so I'm wondering why it might not be working.
Any help would be greatly appreciated!
Swiffy does indeed support URLLoader!
I think your problem is this: if you open up your converted html file in your browser and also open up the developer tools console (try hitting F12), you should see an error message along the lines of:
XMLHttpRequest cannot load .../...myText.txt. Cross origin requests are only supported for HTTP.
Because you've open up the converted html page by itself, your browser isn't letting the code in that page fetch any other files, because they aren't being treated as coming from the same origin (even though they might well be sitting in the same directory) due to the same origin policy.
To get around this, you should access the swiffy html by fetching it through a local web server, something like apache (php) or node (javascript).
(It should also be working normally if you upload it onto the internet.)
I have a problem here regarding flash+as3.
I'm makin an application that take data from XML file and show it on flash.
Now here's my problem.
When I preview the file, it went just fine. All the data been shown on the flash.
When I published it into .exe file, it also went just fine. All data been shown.
But...
When I published it into .swf file, there's a problem. All the graphical images been show, but data that i got from the XML file does not shown.
But when I took the published file and drag it into flash, it went just fine. All the data been shown.
I'm not quite sure what happen. Is there any setup that I have to do to solve this problem?
Thanks guys.
2 possible problems:
your path to the xml data is relative and your published swf can't find it.
More likely your xml data is on a web server and you are looking at the swf through a local webpage using file:///myfile.html. This fails because of security. Adobe have decided that local swfs can only look at local content, and network swfs can only look at network content. This rule is disregarded in the flash ide because if you have the flash ide you are a developer and you should know what you are doing.
Check out your swf on a web server and report back.
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.
I'm just playing around with HTML, and wanted to create a link to access a file in a particular location on the disk (not on the disk where the source code of the web page is located).
I have tried to do the following:
Download My File
but this cannot access the file and gives an error.
What can be the problem, and how do I fix it?
Thanks!
This should work! Just add file:/// in the link URL
Download My File
This will only work if you run the Application offline.
There is no way you can do this with pure html. You will need to use a dynamic web technology such as php or Asp.net.
Can you imagine the security issues if you could download any file you wanted off the web server just by changing path of that link?