Can I use file names from some folder to specisfly a value of a variable

so here is the thing I want to do:
I've got like 3 variables in my swf file which value tells to
the code how many picture there are to load.
So I have like
var totalPics:Number = 5
in my folder images I have 5 pics, but I want to put 3 more
so I want to make suck code that will check the total files in the
folder and return a value of 8 or check the name of the last file
found in the foulder like pic8.swf (I've made it into swf to load
in a loader) and to take that letter 8 from it as a value to put in
the variable totalPics so it is = 8.
Can u tell me is this possible to make in flash.... where I
should read helps or guides .. or just give me a simple example
please.
Thank u a lot. If u have any more questions, just ask me..

Very helpful of you guys ;] Thanks a lot.. so lets continue
on the matter..
GWD the second option is good but can work in a simplier
code.. mine is a bit complexed and by that I mean.. that the total
number of pics or things to load should be known for the main swf
file at his start. That is because before the turn for the pics to
load comes, there is something else that must happen first, and it
depends on that total number (actually 3 total numbers cuz there
are 3 folders with different pics that must mix) So.. can't use the
second option cuz it works good when the code is a bit more simple
than that.
If u didn't understand whant I tried to explain.. doesn't
matter.. not so important atm.
Now the thing with the LoadVars.. yes, I've been thinking the
same thing but like this: At the 1st frame in the main timeline I
have 3 variables that are used further in the code and that must be
predefined by how many pics there actually are, so.. I've been
thining to make 3 different var1.txt, var2.txt and var3.txt files
for example and to put there as value just the number I need. So
when I add more pics for example to my images folder, I edit the
txt file containing their total number and just change it so the
code can automatically add the new pics to the sequence.
I've got some examples of this how LoadVars works with txt
files and I think I can manage to do that, but anyway would be nice
of you to give me some example ;] and of course correct me if my
toughts above are not true.
Now.. SumTsb.. what u mentioned, I am interested in, because
I have a PHP guy, who can make me a code that automatically counts
and gives back the totalPics number from a certain folder (I don't
know for sure that it is possible but if it is he can do it). My
point is.. When he makes this code.. that reterns value of
totalPics, how can I redirect it so it changes the value of
totalPics inside my main swf file. I see only this as option at the
moment:
1) when someone adds or deletes files from the folder the php
code returns a different value, equal to the number of files in the
folder, and automatically changes the content of the file var1.txt
like this:
First off var1.txt has: &content=10 // this is the total
number of pics/swf files in the folder;
when u add.. like 3 more files.. the php code changes the
value inside of var1.txt to: &content=13 and when the main swf
is started he takes the new value and my problem is solved. Is this
what I say as example true ? If it is I guess the only thing left
for me is the php programer to make his code and job is done.
But answer me this question too: is it possible the php code
to return the value of the totalPics directly into the main swf
file. So if I have inside the main swf a variable at the first
frame ot the main timeline called totalPics, can the php give it a
value equal to the total numbers of files in a folder, and how ?
I guess I've written too too much :D so I'll wait what u will
answer me now.. I think you understood my idea.. and if more
questions arise I will write u back. And if no.. I will just thank
you a lot :D

Similar Messages

  • How to get the file name from downloads folder with the applescript??

    Hi All..
    I am downloading an application to downloads folder, I need to install the same application after downloading programatically.
    So how do I get the filename in runtime while downloading or after downloading from downloads folder with Applescript or Java?
    Also my download URL link doesnot contain full name of the download file.
    Pls suggest.

    Hi,
    The best method is to use curl.
    Other methods are not reliable, but can work, it depends on several factors (what the script does, what the user does).
    Here is an example with the curl command:
    set tUrl to "http://sourceforge.net/projects/vlc/files/2.0.4/macosx/vlc-2.0.4.dmg/download?ac cel_key=60%3A1350656196%3Ahttp%253A//www.videolan.org/vlc/download-macosx.html%3 A7233e4e9%245818d66f39b0576e1e9c4a0f3b46b1991180bfdd&click_id=976a88ee-19f7-11e2 -9a21-0200ac1d1d8e&source=accel"
    set dFolder to path to downloads folder
    tell application "Finder" to set newFolder to (make new folder at dFolder) as string
    set f to quoted form of POSIX path of newFolder
    do shell script "cd " & f & " && curl -L " & tUrl & " -o 'vlc.dmg'" -- download  to file "vlc.dmg"
    set downloadedFile to newFolder & "vlc.dmg" --<-- HFS path
    --do something with the downloadedFile

  • Extracting file name from directory folder (~cont)

    what if I want to retrieve indiviual files of a certain file type...e.g. *.jsp file type, from a directory folder??

    You can implement a FileFilter, then use the listFiles method of the File class to return the related files:
    import java.io*;
    public class JspFileFilter implements FileFilter {
         public boolean accept(File pathname) {
              return (pathname.getName().endsWith(".jsp"));
         public static void main(String[] args) {
              File directory = new File("c:/web");
              File[] jspFiles = directory.listFiles(new JspFileFilter());
              for (int i=0;i<jspFiles.length;i++) {
                   System.out.println(jspFiles[ i ].getName());
    }

  • Copying file names from a folder into excel?

    I have a folder with over 200 files.
    I would like to copy the information/file names of these files into an excel spread sheet.
    I don't need to get all other extensions and information just the file names.
    Is there a way to do this?

    Open the folder,
    Select All,
    Copy,
    Open Excel and select a cell
    Paste.

  • Export File Names from a Folder to a Database Program

    Ok, so this one probably fairly simple, I just cant seem to figure out how to do it. I have a folder containing over 200 file names. It is my wish to figure out a way to import all the file names (just the names) into a document, preferably an MS excel doc. I assume their is a way to do this with auditor maybe, but I am not sure. Any one know how to do this.
    Thanks for your help in advance

    Hi, Tim. This should do it for you:
    http://www.corieslate.com/projects/filelister/index.html

  • Can't remove file name from portfolio-9 Pro

    I've unchecked the Name box in the Specify File Details but the file name still appears in the portfolio display.
    Help much appreciated.
    Paul

    Try this...
    In terminal type
    defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO
    charlie

  • Extracting file name from directory folder

    Hi,
    I need to loop a folder to retrieve out individual files.
    Is there any way to do it??
    Thank You!
    Michelle

    import java.io.File;
    File dir = new File("your directory name");
    File[] files = dir.listFiles();
    for (k=0; k < files.length; k++) {
      File currFile = files[k];
      do something
    }

  • How to delete file names from Adobe Reader list

    How can I delete file names from the Adobe Reader list?  I have deleted the file & it's empty, but deleted file names remain in my list & it's very annoying.  I can't seem to find an option anywhere to delete the file names.

    Thanks for the answer, I will try this & post my results with this method.  I have set the amount to zero, & it seems if I want to put back valid files into my list I first need to find them in another file in my pc, such as documents, open them in Adobe Reader, & then then they will reappear in the Adobe Reader list.  Is this correct?  Thank you!
    This seems to be the case, you need to restore each file you want in your list one by one by accessing them elsewhere on your pc, & then you must open them with Adobe Reader to have files reappear in your Adobe Reader list.  However, this seems to be a tedious process if you only want to delete one obsolete file from your list by first emptying the list & rebuilding it file by file.  It works, but I'm wondering if there is a more sensible & efficient way to do this?

  • File name from a path

    hi ,
    there is a path "c:\abc\abc\abc\abc\abc.doc", i have to get file name from it.
    but i had to write a dynamic code which can get the file name from any given path.

    Smoke me a kipper, I'll be back before breakfast.
    SQL> var extended_filepath varchar2(128)
    SQL> exec :extended_filepath := '/this/is/a/path/to/a/file.txt'
    PL/SQL procedure successfully completed.
    SQL> select instr(:extended_filepath, '/', -1)
      2  from dual
      3  /
    INSTR(:EXTENDED_FILEPATH,'/',-1)
                                  21
    SQL> select substr(:extended_filepath, instr(:extended_filepath, '/', -1) +1)
      2  from dual
      3  /
    SUBSTR(:EXTENDED_FILEPATH,INSTR(:EXTENDED_FILEPATH,'/',-1)+1)
    file.txt
    SQL> Cheers, APC

  • Offline Folder can not chaange the letter of a file name from capital to lowercase

    Dear Expert,
    we deploy the offline folder to end users, there is a strange issue happened now, if user tries to change the letter of a file name from capital to lowercase, the system will show "You need permission to perform this aciton". But other actions
    are fine, like, create, delete, rename, etc.

    Hi,
    Please check if the offline folder is made available offline to end users. The Offline Files feature uses the client-side cache (CSC) database.  When the files are made available offline, the CSC database prevents users from changing the case of file
    names.
    For more detailed information, please refer to the article below:
    You cannot rename files by using different case when the files are made available offline in Windows Vista or in Windows 7
    http://support.microsoft.com/kb/953945/en-us
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How can I assign image file name from Main() class

    I am trying to create library class which will be accessed and used by different applications (with different image files to be assigned). So, what image file to call should be determined by and in the Main class.
    Here is the Main class
    import org.me.lib.MyJNIWindowClass;
    public class Main {
    public Main() {
    public static void main(String[] args) {
    MyJNIWindowClass mw = new MyJNIWindowClass();
    mw.s = "clock.gif";
    And here is the library class
    package org.me.lib;
    public class MyJNIWindowClass {
    public String s;
    ImageIcon image = new ImageIcon("C:/Documents and Settings/Administrator/Desktop/" + s);
    public MyJNIWindowClass() {
    JLabel jl = new JLabel(image);
    JFrame jf = new JFrame();
    jf.add(jl);
    jf.setVisible(true);
    jf.pack();
    I do understand that when I am making reference from main() method to MyJNIWindowClass() s first initialized to null and that is why clock could not be seen but how can I assign image file name from Main() class for library class without creating reference to Main() from MyJNIWindowClass()? As I said, I want this library class being accessed from different applications (means different Main() classes).
    Thank you.

    Your problem is one of timing. Consider this simple example.
    public class Example {
        public String s;
        private String message = "Hello, " + s;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example();
            ex.s = "world";
            System.out.println(ex.toString());
    }When this code is executed, the following happens in order:
    1. new Example() is executed, causing an object to constructed. In particular:
    2. field s is given value null (since no value is explicitly assigned.
    3. field message is given value "Hello, null"
    4. Back in method main, field s is now given value "world", but that
    doesn't change message.
    5. Finally, "Hello, null" is output.
    The following fixes the above example:
    public class Example {
        private String message;
        public Example(String name) {
            message = "Hello, " + name;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example("world");
            System.out.println(ex.toString());
    }

  • Same file name from sender to receiver file adapter with out using UDF

    Hi All,
    I am working on FILE TO FILE. My requirement is same file name from sender to receiver file adapter. Is it possible to do using only Adapter Specific message properties?  i mean with out using UDF.
    Thanks
    Karthik

    Hi,
    >>>Is it possible to do using only Adapter Specific message properties?
    yes
    just enable Adapter Specific message properties in sender and receiver channel for file name
    and you're done
    Regards,
    Michal Krawczyk

  • Can we possible to retrive the file name from the directory...?

    Can we possible to retrive the list of files or file names from the directory...?
    The directory called create or replace directory [directory_name] as ....

    Yeah, yeah its very good example for this scenario.
    I agree. But, I want to learn about Java based PL/SQL code development for that just I am asking any link for this kind of material.....:-)

  • Is there a way I can set iTunes to add files automatically from a folder in my Windows PC?

    Is there a way I can set iTunes to add files automatically from a folder in my Windows PC and ensure that it is synced automatically? For example, if I add or modify a file in that folder it should be added to iTunes automatically. At the same time the original files in the folder should not be re-organized. That is can I just point to a music folder in my hard drive and sit back for iTunes to do the rest?

    Rishitani wrote:
    ..is there a way i can get it to start apart from restoring...
    Nope.
    Restore “...
    http://support.apple.com/kb/HT1414
    If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/HT1808
    Note on Recovery Mode.
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    Once you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup
    http://support.apple.com/kb/ht1766

  • How to get the target file name from an URL?

    Hi there,
    I am trying to download data from an URL and save the content in a file that have the same name as the file on the server. In some way, what I want to do is pretty similar to what you can do when you do a right click on a link in Internet Explorer (or any other web browser) and choose "save target as".
    If the URL is a direct link to the file (for example: http://java.sun.com/images/e8_java_logo_red.jpg ), I do not have any problem:
    URL url = new URL("http://java.sun.com/images/e8_java_logo_red.jpg");
    System.out.println("Opening connection to " + url + "...");
    // Copy resource to local file                   
    InputStream is = url.openStream();
    FileOutputStream fos=null;
    String fileName = null;
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
                    fileName=st.nextToken();
    System.out.println("The file name will be: " + fileName);
    File localFile= new File(System.getProperty("user.dir"), fileName);
    fos = new FileOutputStream(localFile);
    try {
        byte[] buf = new byte[1024];
        int i = 0;
        while ((i = is.read(buf)) != -1) {
            fos.write(buf, 0, i);
    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (is != null)
            is.close();
        if (fos != null)
            fos.close();
    }Everything is fine, the file name I get is "e8_java_logo_red.jpg", which is what I expect to get.
    However, if the URL is an indirect link to the file (for example: http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719 , which link to a file named JavaSetup6u18-rv.exe ), the similar code return AutoDL?BundleId=37719 as file name, when I would like to have JavaSetup6u18-rv.exe .
    URL url = new URL("http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719");
    System.out.println("Opening connection to " + url + "...");
    // Copy resource to local file                   
    InputStream is = url.openStream();
    FileOutputStream fos=null;
    String fileName = null;
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
                    fileName=st.nextToken();
    System.out.println("The file name will be: " + fileName);
    File localFile= new File(System.getProperty("user.dir"), fileName);
    fos = new FileOutputStream(localFile);
    try {
        byte[] buf = new byte[1024];
        int i = 0;
        while ((i = is.read(buf)) != -1) {
            fos.write(buf, 0, i);
    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (is != null)
            is.close();
        if (fos != null)
            fos.close();
    }Do you know how I can do that.
    Thanks for your help
    // JB
    Edited by: jb-from-sydney on Feb 9, 2010 10:37 PM

    Thanks for your answer.
    By following your idea, I found out that one of the header ( content-disposition ) can contain the name to be used if the file is downloaded. Here is the full code that allow you to download locally a file on the Internet:
          * Download locally a file from a given URL.
          * @param url - the url.
          * @param destinationFolder - The destination folder.
          * @return the file
          * @throws IOException Signals that an I/O exception has occurred.
         public static final File downloadFile(URL url, File destinationFolder) throws IOException {
              URLConnection urlC = url.openConnection();
              InputStream is = urlC.getInputStream();
              FileOutputStream fos = null;
              String fileName = getFileName(urlC);
              destinationFolder.mkdirs();
              File localFile = new File(destinationFolder, fileName);
              fos = new FileOutputStream(localFile);
              try {
                   byte[] buf = new byte[1024];
                   int i = 0;
                   while ((i = is.read(buf)) != -1) {
                        fos.write(buf, 0, i);
              } finally {
                   if (is != null)
                        is.close();
                   if (fos != null)
                        fos.close();
              return localFile;
          * Returns the file name associated to an url connection.<br />
          * The result is not a path but just a file name.
          * @param urlC - the url connection
          * @return the file name
          * @throws IOException Signals that an I/O exception has occurred.
         private static final String getFileName(URLConnection urlC) throws IOException {
              String fileName = null;
              String contentDisposition = urlC.getHeaderField("content-disposition");
              if (contentDisposition != null) {
                   fileName = extractFileNameFromContentDisposition(contentDisposition);
              // if the file name cannot be extracted from the content-disposition
              // header, using the url.getFilename() method
              if (fileName == null) {
                   StringTokenizer st = new StringTokenizer(urlC.getURL().getFile(), "/");
                   while (st.hasMoreTokens())
                        fileName = st.nextToken();
              return fileName;
          * Extract the file name from the content disposition header.
          * <p>
          * See <a
          * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html">http:
          * //www.w3.org/Protocols/rfc2616/rfc2616-sec19.html</a> for detailled
          * information regarding the headers in HTML.
          * @param contentDisposition - the content-disposition header. Cannot be
          *            <code>null>/code>.
          * @return the file name, or <code>null</code> if the content-disposition
          *         header does not contain the filename attribute.
         private static final String extractFileNameFromContentDisposition(
                   String contentDisposition) {
              String[] attributes = contentDisposition.split(";");
              for (String a : attributes) {
                   if (a.toLowerCase().contains("filename")) {
                        // The attribute is the file name. The filename is between
                        // quotes.
                        return a.substring(a.indexOf('\"') + 1, a.lastIndexOf('\"'));
              // not found
              return null;
         }

Maybe you are looking for

  • Error while using XML

    One of my users while trying to send a a batch of information to the main database by XML had the following java execption code ORA-01401:inserted value too large for column. But I can't find which column is the one affected. Thanks

  • Mysterious file in home folder

    This may not be a problem, but it would be good to make sure. There is a strange file in my home folder called "Opera 7 preferences.new". Does anyone know what the function of a file with that extension ".new" is? I'd appreciate any feedback, thank y

  • Iphone not compatible with Samsung LCD TV

    Hi, I have an Iphone4 and a Samsung 6000 series LCD TV. I've tried tv out through an Iphone dock to the tvs AV input .... ie the three phonos into a single jack av lead. The iphone says playing to tv but the tv says "no device found". I rang Samsung

  • (9I) INDEX의 사용여부 확인하기

    제품 : ORACLE SERVER 작성날짜 : 2002-04-03 (9I) INDEX의 사용여부 확인하기 ============================== PURPOSE Oracle9i에서는 만들어진후 사용되지 않은 index을 찾을수 있는 feature가 소개되었다. Explanation ALTER INDEX MONITORING USAGE 절을 이용하여 작업 시간동안 사용되지 않는 index을 찾을 수 있다. Example < Simpl

  • S_ALR_87012357 update document, what filed ?

       Hello All , When we run the VAT reprot S_ALR_87012357 with Update document selected, what is the filed / table that are impacted with this option ? Is there a way to see all documents 'updated' by the VAT report and  where is this flag ? Thank you