A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: for loop help please

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    4

    for loop help please

    i need a lil help with a for loop.


    this is ONLY my for loop not my whole script.
    and without the "for" it loads a single picture perfectly fine, but i would like to loop it to load all photos...
    this is all as3

    (i called vars into flash like numpics, it gives the number of pics so yeah a little note)




    for (var i:int=0; i<=numpics;i++){


    var picLoader:Loader = new Loader();
    var picknum= event.target.data.numpic;
    xPos = event.target.data.picx;
    yPos = event.target.data.picy;
    var photoRequest:URLRequest = new URLRequest("/storage/photos/" +picknum+ ".swf");
    picLoader.load(photoRequest);

    function loadPics (event:Event) {

    var myClip:MovieClip = event.target.content;
    myClip.photo_mc.x = xPos;
    myClip.photo_mc.y = yPos;
    addChild(myClip);

    }
    }

    picLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, loadPics );

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    So what's the problem?
    Wile E. Coyote - "Clear as mud?"

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    4
    well like its not for-ing my photos,
    lol but actually i kinda got it, i just needed to add [ i ] and i changed the script around differently so yes.

    but thanks for your time though

Tags for this Thread

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