Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default General Action Scripting Loops, comparisons, loadMovie

    I have been struggling with a preloader for a slideshow for some time.

    Below is the code which I use to load images into my slide show. The action scirpting is isolated on the upper most layer in the flash file.

    I have added "trace" statements to help me trouble shoot. I have been troubleshooting one step at a time and I think I have found an issue. But I don't know the cause.

    In the output window the first trace statement yields the correct value for i starting with 0.

    In the output window the second trace statement yields the correct value for image file and location derived from the xml file.

    In the output window the third trace statement yields the correct value for movie clip instance name derived from the data set included at this level of code.

    Now this is what I don't understand

    The next variable: sI. Ask to be assigned the value of the File size of the movie clip.

    The trace step outputs the value of sI. I receive an "undefined". In order to due a proper preloader I need to compare the file size to the amount loaded. I have run experiments and file loaded also yields an "undefined" value. Comparing the two values always equals out. So, the preloader doesn't work, since logic statements are written to evaluate the difference between file size and amount loaded.

    My question is: why do I receive the value of undefined?

    function loadXML(loaded)
    {
    xmlNode = this.firstChild;
    image = [];
    size=[]
    loaded=[]
    myInstance = ["Image 1","Image 2","Image 3","Image 4","Image 5","Image 6","Image 7","Image 8","Image 9","Image 10","Image 11","Image 12","Image 13","Image 14","Image 15","Image 16","Image 17","Image 18","Image 19","Image 20","Image 21","Image 22","Image 23","Image 24","Image 25"]
    total = xmlNode.childNodes.length;
    for (i = 0; i < total; i++)
    {
    trace(i);
    image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    trace(image[i]);
    loadMovie(image[i],myInstance[i]);
    trace(myInstance[i]);
    sI = myInstance[i].getBytesTotal();
    trace(sI);
    } // end of for
    } // End of the function
    images="images.xml"
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load(images);
    xmlNode = this.firstChild;

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2

    Default Learned alot

    I decided to post a response to my own post with the results I discovered.

    1. How valuable the debugger window is.
    2. Avoid Movie Clip Instance names that are two or more words (i.e have a space in the name).

    I did manage to get the size value however I am not able to use nice variables and arrays.

    Through the debugger window I noticed that my movie clips were loaded to _level0.

    by adding: si=_level0.image1.getBytesTotal(); I am able to actually get the size.

    I don't understand why variable arrays do not work for this function but I am able to use my preloader now ... and that all that counts.

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Drawing in General
    By Master Smurf in forum Newbies
    Replies: 2
    Last Post: 05-16-2006, 08:45 PM
  2. Action Scripting
    By kguerrero in forum Flash Scripting
    Replies: 3
    Last Post: 11-01-2005, 12:25 AM
  3. action scripting help please
    By designerindex in forum Newbies
    Replies: 1
    Last Post: 06-21-2005, 07:55 PM
  4. Controlled Loops. How, please?
    By FranksBank in forum Newbies
    Replies: 5
    Last Post: 09-30-2004, 08:09 PM
  5. Slide Show using flash action scripting..
    By REfL3ct in forum Flash Scripting
    Replies: 0
    Last Post: 09-16-2004, 11:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial