ActionScript 3.0 :: FilesFilter On Opening Directory?
Aug 4, 2011
I'm using the following code to open a directory, place the directory listing into an array, and then only deal with certain file types (I don't want the user to be able to select individual files, just a directory):
newMediaFile.browseForDirectory("Select your file/files");
and then later in the code, asign the listing to an array called list:
list = newMediaFile.getDirectoryListing();
I was wondering if there is some way to use filesFilter with browseForDirectory to retrict the file types added to list when I use getDirectoryListing? Currently I have a conditional checking the suffix of each file.
When I have a class linked to a MovieClip in my library and that class takes an argument in its constructor method. That class will compile properly ONLY when it's located in my top-level directory (same dir as the .fla and Document.as files). If I move that class to a deeper directory, say com.place, and update the package statement and symbol link appropriately, the compiler will generate error "1136: Incorrect number of arguments. Expected 0."Create flash project and put a rectangle on the stage. Covert it to symbol and assign it to class TestPanel - or whatever you choose. Also configure the fla so that is uses a Document (Main) class.Create Main.as and TestPanel.as in the same folder. In the Main class, instantiate a instance of TestPanel and add it to the stage. Flash will, predictably, add the rectangle symbol and everything is fine.Now modify TestPanel so that its constructor method takes a Number and have Main.as pass some number to TestPanel.[code]You now get the error: 1136: Incorrect number of arguments.Expected 0.When I move the TestPanel.as into a deeper directory, Flash somehow is looking elsewhere for the base class for Symbol, even though I'm mapping that Symbol to com.place.TestPanel.
that can open and save XML data (using the v10 plug-in). The client wants to add a drop down populated with a list of the XML files saved in a Calculations folder. not exactly sure if AS3 can dynamically read the contents of a directory (this would have to work both online and when run as a local app, so server side scripting is not an option). Right now my only idea is to use a manually created XML file that contains a list of the other files in the directory, but this seems quite cumbersome, I rather have the app. just dynamically read wha in the folder.Flash image browsers seem to be able to read all J in folder X, is this kind of thing done strictly through server side scripting?
I am trying to load up a xml file from an external source... I search the error code (#2044) and apparently xml can't be loaded unless its in the same directory...
I think this is silly and there must be away around it?
I'm following a tutorial I found on these forums about importing. I'm trying to understand it, but I can't even get the simplest import to work. I get a compiling error: 1084: Syntax error: expecting identifier before as. My form.fla:
is it possible to get the current directory the swf is in? like if I have a movie in a folder called "folder01", i would like to have some code in the movie that returns "folder01".. and if it's in "anotherfolder", it returns "anotherfolder", and so on..
I am making a site, this site is in a folder, inside of this folder I have the index.html file and a load of other html files. I then have a folder, flashheader. with a flash header that has 5 tabs on it. When I click a button, I want to navigate to another URL, this URL being in the parent.
PHP Code: tab1.addEventListener(MouseEvent.CLICK, myBtnClicked1); function myBtnClicked1(e1:MouseEvent):void { var url:String = "../index.html"; var request:URLRequest = new URLRequest(url); try { navigateToURL(request, '_self'); } catch (e1:Error) { trace("Error occurred!"); }}
There is my code, it listened for the tab to be clicked, and when it is, it loads the URL.
I am trying to create a Flash file where it will read the contents of a directory and automatically compile them into a simple slideshow with basic transitions (simple fade-in/fade-out transition). The files that will be read are either JPG, GIF, SWF. Is this possible with just using ActionSCript (either 2 or 3) ?
I am doing some testing with various methods of deep linking in a flash site and have created a test site with the following structure: /index.html /simple.swf /two/index.html three/index.html
The index.html file located at the root of the site loads the simple.swf file using an absolute reference to the file (view the source of [URL]). The index.html file located in directories "two" and "three" are exactly the same as the index.html file in the root directory with the exception that I have added a defined a "base" parameter pointing to "../". [Right now, I am passing the same "flashvars" parameter in each of these files, however, once I resolve this issue, I will change the flashvars value.]
For some reason, the simple.swf file loads in the root level index.html file but not in the index.html file located in directories "two" or "three". I am confused why this is not working since I am using an absolute reference to the file. The only possible meaningful difference I can see is that the simple.swf file is only located in the root directory.
I insert my swf using a relative url to the file, and I want the swf to call a javafunction but i get no response. why the swf is not in the same directory as the html file.
my as:
function checkInput() { var result:Object = ExternalInterface.call("checkTheInput"); myTxt.text = String(result); }
I try loading my video from a swf file using flvplayback component using the script below
[Code]....
but I notice that the swf file doesnt link the video instead i have to place my video the same directory with the swf file and change to flvPlayback.source = "Listening_to_Community_Voices.flv"; Does that mean the video file im linking must be on the same directory as the swf or did I wrote my code wrongly.?
I need to download a file for example say, a pdf file from a url and store it in applicationsDirectory or ApplicationStorage directory, I have a code to download but its opening save dialog box to get the userinput for where to save the downloaded file. This is the code that I am using
I have a web service running in http://server/abc/service which is being accessed by Flash from a different domain. I deployed a cross domain policy file to http://server/abc/crossdomain.xml and made the Flash load it using: flash.system.Security.loadPolicyFile("http://server/abc/crossdomain.xml");
in the constructor of the main movie clip. However, when the Flash starts, it requests and loads this file (observed in Firebug), but then it also requests it from the root of the server (i.e. from http://server/crossdomain.xml) which does not exist. Subsequent HTTP requests don't work reporting security cross domain errors. When I put the policy file to the root of the server, it all works. Why does it request the policy file from the root as well even thought it loads it from the subdirectory? Why the subdirectory policy file is not enough?
I should also note that the two policy files are loaded before any application HTTP requests are issued.
is there a way to get the current directory of the project? i'm trying to load images using dynamic paths and it seems that the link is broken. but seeing the current directory of the running project i'll be able to make sure that my picture links are valid.
I need to get a random filename from a directory in AS3, and open it. (This will be online, so no AIR)
I'm thinking of just using a text/xml file with all the filenames listed, and just traverse through it getting the filename. But is there a more "direct" way to just look at the directory so I don't have to edit the text/xml file all the time?
Anyway what im trying to achieve is - AS reads a directory on a server lets say, it contains 10 images, this would create movie clips for each one and assign them to array "pockets"(im not sure if you can do this in AS, you can in PHP and JS so I'd expect so) then I'd use a repetitive function to manipulate each one of those images.
I have my files organized in various directories on the server. If I'm in Directory A, how do I link to a file in Directory B? I know how to drill down into a directory using forward slashes, but I can't recall how to drill back up (or however you say it).
How do I rewrite this so that my button links to the PDF in a separate directory?
on (release) { getURL("DirectoryA/bio.pdf","blank"); }
My insuffiecient knowledge about AS2 craves some teaching: I want to know how to add an action to a button within my scene to make it download a file, which is located in the same folder as the .fla and exported .swf. In this case its going to be a .pdf, but I guess my main point is that I just want it to download the file. It should work in both Firefox and Internet Explorer (I don't know if the script has to be different or not?).
Trying to fix other peoples bad coding and I can not change the file structure but I would like to add a class directory and be able to reference it for buttons and variables. The problem is that the directory needs to be up 1 directory so that it can work with all the other files.
Also I need to be able to set it as the symbol property "linkage" class file so I can apply the class to all the buttons.
File folder structure:
Main folder New class files FLA files Folder holding more FLA files More FLA files