Hello!
I can not figure out why my code here is not working… (i guess that’s pretty obvious or I would not be posting it!).
Would you mind taking a look at this and possible you can spot what it is that I have wrong?
I am getting the error:
TypeError: Error #2007: Perameter url must be non-null.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at asFiles.reality::RealityScenarios/loadImage()[C: (networkpath).as:226]
here is where line 226 is:
public function loadImage(e:MouseEvent):void {
imageHolder = new MovieClip;
imageLoader = new Loader;
imageLoader.load(new URLRequest (subImageArray[Number.e.target.name)])); //THIS IS LINE 226
imageHolder.addChild(imageLoader);
imageHolder.x = 75;
imageHolder.y = 75;
addChild(imageHolder);
}
e.target.name then refers to this:
public function addButtonEffects():void {
bp.addEventListener(MouseEvent.CLICK,previousSubject);
b1.addEventListener(MouseEvent.CLICK,loadImage); //I CLICKED THIS BUTTON IN PARTICULAR BUT THE SAME ERROR OCCURS FOR b2, b3, AND b4
b2.addEventListener(MouseEvent.CLICK,loadImage);
b3.addEventListener(MouseEvent.CLICK,loadImage);
b4.addEventListener(MouseEvent.CLICK,loadImage);
bn.addEventListener(MouseEvent.CLICK,nextSubject);
}
that then refers to this code:
public function drawButtons():void {
var ba:Array = new Array();
ba.push(bp,b1,b2,b3,b4,bn)
for(var i:uint=0;i<ba.length;i++) {
addChild(ba*);
ba*.x = 390 + i* 100;
ba*.y = 900;
}
for(var j:uint=0;j<1;j++) {
trace(ba[j]);
btnBack = new BtnBack();
ba[j].addChild(btnBack)
ba[j].buttonMode=true;
}
for(var k:uint=1; k<5; k++) {
trace(name + ba[k]);
ba[k].name = k; //HERE IS NAME
textfield = new TextField();
textfield.text = realityArray.shift();
textfield.setTextFormat(realityformat);
textfield.autoSize = TextFieldAutoSize.LEFT;
textfield.selectable = false;
textfield.antiAliasType = AntiAliasType.ADVANCED;
textfield.embedFonts = true;
textfield.scaleX = .2;
textfield.scaleY = .2;
ba[k].x = 640;
ba[k].y = 900;
ba[k].addChild(textfield);
ba[k].buttonMode=true;
addChild(ba[k]);
TweenLite.to(ba[k], 1, {x:380 + k * 100, y:880, scaleX:4, scaleY:4});
}
for(var l:uint=5;l<6;l++) {
trace(ba[l]);
btnNext = new BtnNext();
ba[l].addChild(btnNext);
}
addButtonEffects();
}
I hope that is not too confusing and makes sense!
I appreciate the help!