I want to load multiple files at one time; I mean that when the open dialog file comes up, I want to be able to select multiple files and then hold the path of them. I know the FileReference Class but it will only get one file at a time. so is there a way to do it??
You can use the FileReferenceList class. This works similarly as the FileReference class you mentioned.
For more info check out the docs:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReferenceList.html
Related
Similar to the uploading feature in fuelphp (link provided below), is there a tutorial for downloading files in fuelphp. There is not much information out there for fuelphp (other than the docs). Would I require a separate config page called download.php similar to upload.php?
All I really need is a page with either a download link or button to export csv to a user's local machine
Link to Upload feature
https://www.tutorialspoint.com/fuelphp/fuelphp_file_uploading.htm
Thanks in advance
Have you looked at the File class? This has a method of download which you pass the path of the file to. The 2nd param allows you to specify the name of the file that's downloaded.
File::download('path/to/file.txt, 'new-file-name.txt');
If you want to restrict downloads per user, you'll need to add logic around that.
https://fuelphp.com/docs/classes/file/usage.html#/method_download
Example
Create a new controller, as you've pointed out, download.php, and use the following as a starting point.
You'll need to pass something through to the get_index in order to determine which file the client will download. I'd suggest some sort of look up, using an unique identifier, instead of a file path, otherwise this would easily be exploited.
class Controller_Download extends Controller
{
public function get_index()
{
// #todo add logic surrounding file download
File::download('path/to/file.txt, 'new-file-name.txt');
}
}
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.
I want to make a Flash app in which the user can load and save files from and to their local hard drive. While I've often done this in AIR apps using the File and FileStream classes, I haven't done so before in an SWF.
From what I know the FileReference class is used for this, although it seems to have some restrictions due to security risks. I'd like to know what the main differences are between using the FileReference class and using the File and FileStream classes to load and save files.
The File class extends the FileReference.
FileReference is safe to be used in the FlashPlayer (in the browser) because it won't let you modify the files in the user machine.
If you want to open a file, you need to as for the user to open it for you with: FileReference.browse().
To save a file, you need to ask the user to save it: FileReference.save()
With File class you can open, modify and save files without those dialogs.
Furthermore, the File class gives you a bunch of useful properties like: File.desktopDirectory, File.documentsDirectory and such.
You can check if a file exists with the exists property and have a much restriction when manipulating file in the user file system.
You can read more about the FileReference and File classes in the docs.
i am working on a project and i got stuck on this one thing, i got a bvh file with an animation which i put on a biped in 3dsmax then i export every frame in to a json file with the thee.js json exporter and then when it gets played i remove the old mesh and add a new one. This causes the model to upload multiple times, which ofcourse is not what i want.
I use the jsonloader and i wondered if there was a way to update only the geometry every frame? Also i made those seperate files because i dont use a skin and i dont have morphtargets because i use a bvh file in 3dsmax.
It would be awesome if someone could help me with this
Example: http://www.deschaatssport.nl/3dsportsvisualiser/versie3/?p=3# (press the play button)
Mathijs Jansen
Assuming your JSON exporter keeps the number and order of faces/vertices intact, you could do something like this:
Load the initial model as you do now
Set geometry.dynamic = true;
Load the rest of the JSON files with plain old AJAX (alternatively you could combine the frame JSON files to one file, whatever so you have access to all of them through your own code)
For each frame, loop the new frame vertex position array (found in the JSON for each frame) and overwrite the coordinates of your existing geometry vertices (geometry.vertices[i].x = myframevertices[i][0]; etc...)
Set geometry.verticesNeedUpdate = true; and render the frame.
Again I'm just assuming that each JSON file has the same amount and order of faces/vertices, and only the vertex positions change in each frame. I'm not completely sure if it works like that.
There has also been some (experimental?) work on BVH support with Three.js. You might have success searching around, I don't know if there is anything usable though. One related effort here: https://github.com/akjava/BVH-Motion-Creator
I have all of my files in version control (SVN subversion). FLA file is not a text file, so when I change it and check it in, there isn't a way to see what has changed inside of FLA.
Is there a way to keep track of changes to FLA file and it's contents?
Flash CS5 has introduced a new file format called XFL which has been designed for use with version control systems. This format basically splits up your FLA file into a series of separate XML data files (all contained within the one folder) which means version control systems can accurately determine what parts of the file have changed.
Simply go to File > Save AS, and select xfl from the drop-down list.
If you're using anything before CS5, then unfortunately there is no similar way to accomplish this task. I will add, however, that if this is the case, then you can try and mitigate this problem by keeping all your code in an external AS file and load any data from external xml/image/etc. files. This way, there is at least some degree of tracking for certain parts of your project.