PDA

View Full Version : Problems adding images


mrnagrom
05-26-2008, 09:27 PM
so i'm trying to make an array of movieclip containers then load images into them then adds them to the stage when they are finished loading. it just gives me one error..
TypeError: Error #1010: A term is undefined and has no properties.



import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;

var the:Array = new Array();
var shit:Number = 0;
var loaders:Array = new Array();

for(var b:Number = 0; b < 20; b++)
{
the[b] = new MovieClip();
stage.addChild(the[b]);
loaders[b].pictLdr = new Loader();
loaders[b].pictURL = "dink.jpg";
loaders[b].pictURLReq = new URLRequest(the[b].pictURL);
loaders[b].pictLdr.load(loaders[b].pictURLReq);
loaders[b].pictLdr.contentLoaderInfo.addEventListener(Event. INIT, imgLoaded);

function imgLoaded(event:Event):void
{
the[b].addChild(loaders[b].pictLdr.content);
}

}



this is my code.. i'm assuming it's pretty off base. i'm just not getting it and getting frustrated.. the tilt factor is setting in.

box86rowh
05-26-2008, 09:32 PM
should : loaders[b].pictURLReq = new URLRequest(the[b].pictURL);

read

loaders[b].pictURLReq = new URLRequest(loaders[b].pictURL);

box86rowh
05-26-2008, 09:33 PM
also, if you debug the app it should tell you what line number is the problem

mrnagrom
05-26-2008, 09:37 PM
i changed the little the to loader.. it still gives me the same error..

how do i define a variable inside of an array.. i haven't been able to figure it out so far. just keeps giving me all kinds of errors.

mrnagrom
05-26-2008, 09:50 PM
WOO HOO..
got it.

made a new object() for each of the loaders array items to attach the loader vars to in the loaders array.

it just wanted an object to stick to.

thanks for your help.