How to deploy SWF file? - html

I have a SWF file I created using Adobe Flex and I cannot seem to properly embed it inside an HTML page. If I take another SWF file and use it instead, it works all the time. My SWF file is pretty big (1 MB) while the other one is tiny (25 KB). However, I can wait 5-10 minutes and the server connection is super fast and it still will never load.
Is there something I need to do to the SWF to have it start up properly? My SWF almost never runs.
Thoughts?

I see two posible problems here:
Browser is not able to download your SWF file
You can check it if you add SWF file name directly into browser URL. For example http://your_domain/page/test.swf. If you will get "Not Found" error then your file was uploaded incorrectly
You did something wrong when embeding SWF file into HTML
If you have a working file then you can try to overwrite it with new one (leave original file name). Problem can be in sigle symbol in new file name, even letter case should match.
Or you can try using swfobject library for embeding flash into html

Related

Is there a way to force a browser to not use a .swf file from cache? From within the .swf file itself?

So I have a .SWF file, there are several people I know calling the .SWF file directly from my server onto their page.
I need to do some maintenance on the .SWF and wanted to replace the current SWF file with one that just says "under maintenance". I know there are ways to do it via html/php but I do not have access to the html/php code the other people are using on their servers to call my .swf file.
I plan to name the .swf file with the same exact name, so it doesn't break for the other people linking to my .swf file from their website.. but my concern is that their users will show the a cached version of the .swf file instead of my new .swf file.
Is there actionscript or anything I can put in the .swf so that it prevents the users on the other site from using a cached version?
Thank you.
If people are loading the SWF file directly, the only thing you can do is replace it by a polite loader.
This new structure would be:
a new SWF with the same new from the previous and rename the original one.
this new "main" file would load the original one appending new Date().getTime() to the end of the file name.
loader.load(new URLRequest('myOriginal.swf?k='+new Date().getTime()));
That should work.
You can reduce the caching period for .swf files via an .htaccess rule. For your purposes, reduce it to 1 hour or less. That will force all the newly requested swf files to be redownloaded.
When you're finished with maintenance, remove the rule or increase the caching period.

delete external text file from .swf file

I have a swf file (game file) which reads the content of external text file which I have created. This swf file will not be used in any browser. It's for windows only. I was wondering if I can delete or update that text file after I read it's content without using air.
Your question isn't very clear, I'm not sure what exactly you wanted to know. But if I understood you correctly:
You cannot delete files from the filesystem in the through Flash Player, but you can however delete it from SWF file's memory.
Deleting from the file system (basically like putting into trash) is something that only AIR can help you with.
Deleting from memory would mean to remove all the listeners from URLLoader or Loader object instance and setting it to null.
You cannot write the file with Flash player to edit it's content (update), but you can load it again and check if anything changed in that file's content that also would be considered as updating.
Hope that answers your question.
you cant do that without air. but you can use an external application using fscommand().
or you can use Multimedia Zinc

Some way to change text of SWF without having Flash?

I have a FLA with some text but the person that will be sending the SWF doesn't have Flash and doesn't know anything about Flash either.
Is there some way to build the FLA so that the text can be changed simply by modifying the SWF somehow? Due to company policy, the SWF cannot read from external files.
We tried programming into the FLA that it read an XML in another server, but that's not allowed. I also cannot send the SWF with another file (ie. an xml file).
Thanks.
Use FLASM or SWFMILL which are free command line assembler/disassembler for swf files. Use any of the one to disassemble your swf. You can open the result file in any of the text editor, find and replace your text and assemble it as swf again. Hope it helps.
It is a strange logic to try to modify a FLA file without Flash. A FLA file is a binary file, you'll need an editor to read it and I'm pretty sure Adobe isn't allowing 3rd party editors legally.
But yes, it's fine to have a dynamic TextField where you can send the parameter and change the data. Please note - you need to send the data. Means it has to come from outside.
What are the options? Well, actually, there are few:
Loading from an external file or getting it from a server side script. You said it's not allowed, let's omit this method.
Read FlashVars. If you publish it within a HTML page, you can actually feed some data via FlashVars. Not only 1 variable, but as many as you want. And it's fine for small strings, but if you plan to pass a text larger than a sentence… Don't do it.
As a funny hack you could try naming your file with the text you want and read the URL of the SWF thus showing it's name and using it as a text data. But don't do it :)^
If you want to try it, you can access the URL with stage.loaderInfo.url, just make sure you have a stage defined - call in the document class or after the display object you're calling from is added to stage.
Use ExternalInterface to communicate with, for example, JavaScript and get the variables from JavaScript. It's actually not so bad, since your text will be tidily stored in a .js file and you can modify it on the run. That of course is a separate file and you need to have the SWF embedded in HTML for that, but it is one of the options you have.
Other than that you could have an external file that will hold the data and embed it in the SWF. Look more on embedding here: http://flashgamedojo.com/wiki/index.php?title=Embedding_XML_in_AS3 . It is about embedding XML data, but you can use the technique for any data, even binary.
Embedding data is a great thing, but you'll need to re-compile each time you make a change in the file, since it isn't loading the file dynamically, but embeds it into to the SWF itself on compile time.
Hope that helps!
JPEXS Decompiler can change text in an SWF pretty easily. It's still actively developed as of 2021.

as3 document class doesn't load

I have a document class in my project and after I update it and put it on server the flash player loads the old version. It doesn't save in the cache memory which I clean every time I test the results, but seems to work when I change the name and modify the swf's doc class. Any idea how I could get around this? My document class is in the same folder the swf is, if it matters.
You must recompile your .swf locally and reupload that to your server. Any classes (.as files) are compiled into the .swf and not loaded by the .swf In fact, there's no reason to put any source code on a server, just like there's no reason to upload a .fla file.

How to export assets from an .SWF container?

Given is an online swf on Hubworld's site, which loads two configuration XMLs into an .swf file, then displays a game. A copy of the Flash with the two configuration files can be found here. (http://db.tt/zYT9Owg5). If unzipped into a folder, it loads the two XML files and displays everything correctly. The problem is, how to take it apart?
I tried decompiling the file, but it only shows up as a (mostly) empty file with a single symbol and a few misc tags inside it, despite the file itself containing several hundreds of vectors. (http://i.imgur.com/si6gq.png). I severly doubt that any sort of encryption or obfuscation is present, since it's a children's game and I took apart many others without a problem. How could I retrieve the said files from the container?
The swf contains another swf embedded as a ByteArray. I'm not sure why, but this is probably an obfuscation technique.
You can view the actual assets by running the swf in SWFWire Debugger. This application will dump the swf that is loaded from the ByteArray into the same folder as fashion.swf. You can then load this in your decompiler, or SWFWire Inspector if you just want to view the assets.