A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Loading images with partial directory?

Threaded View

  1. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Here is something that can help you look for and load the correct image from the correct folder on a daily basis.

    paste this into a new fla and see what happens
    PHP Code:
    var TheAlpha:Number 70;

    function 
    GetImage()
    {
        
    // Declare New Date
        
    Today = new Date();
        
    // Number Month
        
    Months = ["01""02""03""04""05""06""07""08""09""10""11""12"];
        
    CurrentMonth Months[Today.getMonth()];
        
    // Get Day Number
        
    CurrentDay Today.getDate();
        
    // Get Year
        
    CurrentYear Today.getFullYear();
        
    // Folder Month
        
    FolderMonths = ["jan""feb""mar""apr""may""jun""jul""aug""sep""oct""nov""dec"];
        
    CurrentFolder FolderMonths[Today.getMonth()];
        
    // Display Date
        
    DateNow CurrentDay CurrentMonth CurrentYear;
        
    trace("Todays date formatted: " DateNow);
        
    // Display Folder to get image from with name
        
    FolderNow "images/" CurrentFolder "/" DateNow "." TheAlpha ".jpg";
        
    trace("Folder and image to get: " FolderNow);
        
    // load respective image
        //loadMovie(FolderNow, P140108.empty_mc);
        //this.P140108._alpha = (TheAlpha);
    }
    // Initially call function to get date ect
    GetImage();
    // Check for new date, currently set at every 1 hour
    GetNew setInterval(GetImage3600000); 
    this currently does not load an image (it can) because I am not sure if you will always be using the same empty movieclip to load into and I'm not sure if you are wanting the dates you have already written down (140108, I assume is 14th /Jan / 2008) ? or current dates ?
    Last edited by fruitbeard; 05-12-2013 at 01:17 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center