A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Problem with loading images!!!!!!

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    5

    Problem with loading images!!!!!!

    i made this xml ...
    HTML Code:
    <cinemix>
        <movie id="1">
    	<name>abc</name>
    	<pic jpgURL="movie2\movie_1129287724.jpg"></pic>
        <movie id="2">
                 <name>abc</name>
    	<pic jpgURL="movie2\aa.jpg"></pic>
        <movie id="3">
                 <name>abc</name>
    	<pic jpgURL="movie2\bb.jpg"></pic>
            <movie id="4">
                 <name>abc</name>
    	<pic jpgURL="movie2\cc"></pic>
    my action script like...

    HTML Code:
       function loadimage() {
       kk = myXML.firstChild.childNodes;
      for (var i=0; i<=kk.length; i++) {
       movie1 = kk[i].firstChild.nextSibling.attributes.jpgURL;
       movie2 = kk[i].firstChild.nextSibling.attributes.jpgURL;
       movie3 = kk[i].firstChild.nextSibling.attributes.jpgURL;
       movie4 = kk[i].firstChild.nextSibling.attributes.jpgURL;
       loadMovie(movie1, movie);
       loadMovie(movie2, movie_2);
       loadMovie(movie3, movieThree);
       loadMovie(movie4,movie_4);
          }
      }
    var myXML = new XML();
    myXML.ignoreWhite = true;
    myXML.load("xml/test.xml");
    myXML.onLoad = loadimage;
    as you can see from the above , there are four movie tags which contains four different images ..but why i can't load the image properly through my action script ?

    1)what is the errors in my script?
    2)is there any correct way to load images by "for-loop"?

    please help..Thank you very much!

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Couple of things.

    In the loadImage function use the variable 'this' instead of myXML, loadImage is called as a callback and your local myXML variable may have gone out of scope.

    I would also put a trace statement before your load movie to find out what movie1~4 variables are being set to, as far as I can tell all 4 variables are going to be set to the same thing.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  3. #3
    Junior Member
    Join Date
    Nov 2005
    Posts
    5
    But ...

    could you please to rewrite the program by using for loop to achieve the goal?

    thaxks..

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