as3 document class doesn't load - actionscript-3

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.

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

Actionscript 3.0(Adobe Flash CS4) Loading external .as files without knowing name of .as file

I want to know how to load external class files(.as files) in actionscript but don't have to know the class file's name. Think of it like loading mods in minecraft with forge mod loader, it doesn't know the main class of the mod's file name, yet it successfully loads the mod. I want to know if something like this is possible in actionscript 3.0 because I feel like making a tower defense game that isn't like the others out there but have it so it can be modded and have mods loaded but of course I have to load the class file without knowing the class file's name.
Note: I don't got access to Adobe Air so I can't use anything that requires Adobe Air.
You want to load a particular .as file AFTER or BEFORE compilation? After the compilation it is hardly possible - the file would not be compiled and therefore it would be useless. Why don't you use a swf or some kind of XML/JSON with settings in that case? Before the compilation you would still need to identify it by it's package name/name.
Basically, you want a plugin management system.
In AS3, it is not possible to "load" a .as file on execution, because it is a (uncompiled) source file. But, it is possible to load another swf and to use the classes within it.
Your process should probably be something like this :
Get a list of the plugins/addons. If you were using AIR, it would have been possible by browsing the content of a folder. Since you're not, you'll probably need to use a listing file (basically, a file that say "Here's the list&path of the plugins you need to load".
Load each swf file
(possibly) call a initialization method for each plugin.
You may wish to look into the way OSMF manages plugins, for example : http://osmf.org/dev/osmf/OtherPDFs/osmf_plugin_dev_guide.pdf

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.

How do I make a flash library that can be either compiled in or loaded at runtime?

I'm looking to make a library that can be either merged into a swf at compile time or loaded into a swf at runtime. The way I understand it, .swc files are generally merged into a swf at compile time, and .swf files are generally loaded into a swf at runtime. Is there a way I can have one file that can do both?
You could try using authortime shared libraries.
Basically you would have an FLA that has the shared animation in a MovieClip. You could build this clip separately as a SWF and use that for any files that need to load it at runtime.
Then, in any other projects that need the clip to be compiled in, you'll create a new MovieClip in that project and link it to the shared clip in the other FLA.
In the Symbol Properties, hit Browse at the bottom in the Source section and navigate to the FLA and then the shared clip. Tick 'Always update before publish'.
Now, if you make changes to shared clip, you'll recompile the SWF that gets loaded, and recompile any of the other projects that use that shared asset. They should automatically import the newest version when they get built.
What are you trying to do? What is the "library" supposed to do or provide? If it's an animation, you can drop it in the IDE and have it compiled in (as opposed to loaded at runtime). If it's code, it's nonsensical to load it at runtime.