A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Loading arrays from a text file into a movie

Threaded View

  1. #1

    Loading arrays from a text file into a movie

    I have created an mp3 player, in MX 2004, that uses arrays to dynamically populate the movie clip. What I would like to do now is place the 2 arrays, artist and title info into a text file, so I can use just one movie to play various cds. Unfortunately, I have not found a good tutorial on how to accomplish this.

    It is a basic script that I will incorporate into the mp3 player once I get the script to work right. There are links in the main movie that will send the appropriate text file to the player.

    Anybody have any suggestions?

    THe following code is what I want placed in a text file:

    -----------------------------------------------------
    var titles = new Array("Track01","Track02","Track03","Track04","Tra ck05","Track06");
    var songNames = new Array("Track01.mp3","Track02.mp3","Track03.mp3","T rack04.mp3","Track05.mp3","Track06.mp3");
    var artist = "Jeffrey Smith";
    var cd = "Let Me Worship You";
    -----------------------------------------------------

    The following code will be located in the movieclip:

    ----------------------------------------------------
    artist_txt.text = artist;
    cd_txt.text = cd;
    var sectionCount = titles.length;

    var menu = this.createEmptyMovieClip("menu_mc", 1);
    menu._x = 25;
    menu._y = 70;


    for(var i=0; i < sectionCount; i++){
    var depthCount = menu.getNextHighestDepth();
    var item = menu.attachMovie("itemClip", "item_" + i, depthCount);
    item.labelName = titles[i];
    item.song = songNames[i];
    item.targetClip = this;
    item._y = i*45;
    }
    ----------------------------------------------------

    Attached is the test fla.

    Any help would be greatly appreciated,
    Rick
    Attached Files Attached Files

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