A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Dynamic jpegs not loading in mc

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    16

    Dynamic jpegs not loading in mc

    Hello,
    I have a main.swf file that loads a news2.swf file into a holder movieclip. The news2.swf file loads jpegs dynamically from a folder named 'images' in the same directory as the news2.swf file. The directory of my site looks like this, starting at the root:
    index.html
    main.swf
    news_swfs/news2/news2.swf

    I am trying to make it work so that I can create additional news.swf files (news3.swf, news4.swf...) in their own folders, inside of the news_swf folder, each with their own 'images' folders. So inside the news_swfs folder would look like this:
    news2/
    news3/
    news4/

    And inside each news folder would look like this:
    news2.swf
    images/

    The problem I am having is that when I use loadmovie, it loads from the main.swf directory, not relative to the news2.swf file. So it looks like I would need to manually direct each newsX.swf file to the newsX.folder. Is there any easier way to make the news.swf file look in the local folder relative to itself rather than the main.swf file? In the news2.swf file, I have tried using without success:
    lockroot = true;

    Basically, I am trying to avoid pointing each news.swf file to a specific images folder, rather just use the images folder in the same directory as the loaded mc.

    Any help would be much appreciated!

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    make sure that the images (if JPEG) are not saved with a pyramid or progressive load option because flash then can´t load them dynamicly. CMYK JPEG can cause issues as well.

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Posts
    16
    the jpeg images are not CMYK, pyramid or progressive load. The issue seems to be in using relative paths (which I need to use), and it is using a relative path to the main.swf, not the news2.swf file that I would like it to be using.

  4. #4
    Junior Member
    Join Date
    Mar 2007
    Posts
    2
    I did something similar using photos of different places. You should just be able to concatenate the relative path. You could use a "for loop" or some other method of determining the current news article.


    var myMCL:MovieClipLoader = new MovieClipLoader();
    var curNewsArticle:Number = ?;
    var picNum:Number = ? //number of pics in article

    function loadPic() {
    _level0.myMCL.loadClip("news_swfs/news" + curNewsArticle + "/images/pic" + picNum + ".jpg", this.picsMC);
    }

    loadPic();


    This assumes each folder would have it's pictures labeled as pic1.jpg, pic2.jpg, pic3.jpg, etc, and the instance name would be picsMC. You most likely wouldn't have to declare your myMCL variable here either as it's in your main swf.
    Last edited by finnigan; 03-22-2007 at 06:40 PM.

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    the paths will be relative to location of the html page your flash movie is embedded in, not relative to where your swf is located..

    it's appearing to you to be relative to main.swf, (but thats only because its in the same directory as your html page)
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  6. #6
    Junior Member
    Join Date
    Mar 2007
    Posts
    16
    thanks everyone, I will try finnigan's approach and let you know how it goes.

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