dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [RESOLVED] URLLOADER load picture to specific frame

  1. #1
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588

    resolved [RESOLVED] URLLOADER load picture to specific frame

    I'm planning to load images via URLLOADER onto the stage.....i want each image to be on a diffrent frame of the main timeline how do i tell each one which frame it belongs to?
    ~calmchess~

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    I'd put the image urls in an Array, and than process those with a for loop, like this:

    Code:
    var arr:Array = ["img1.jpg","img2.jpg","img3.jpg"];
    
    for(var i:uint = 0; i < arr.length; i++)
    {
         this.addFrameScript(i+1,loadImg(i));
    }
    
    function loadImg(index:uint):void
    {
         var imgLoader:Loader = new Loader();
         imgLoader.load(new URLRequest(arr[index]));
         addChild(imgLoader);
         // delete the function by passing null
         this.addFrameScript(index+1,null);
    }
    Test this out, I wrote this right now, so it may have some bugs
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    Thanks for the code..... cuts my workload down seems to work from intial glance........i've gotta get my controls out from behind the image.........something i don't understand though is .......addFrameScript......doesn't seem to have a code hint....what is it?
    ~calmchess~

  4. #4
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    well this loads the image but to some unknown location its not frame1 becuase the picture still exsists when i move to frame 2......how do i load each picture in the array into a specific frame of the main timeline?
    ~calmchess~

  5. #5
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    I made a solution i just made a movie clip on each keyframe then loaded each picture into the clip.....down in dirty in my opinion but effective.
    ~calmchess~

  6. #6
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    addFrameScript is an undocumented method in AS3, you'll find it when you google for it, but it's not code-hinted, as you experienced
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

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