PDA

View Full Version : Error #1069



vxd
October 5th, 2008, 08:45 AM
I get this error only when I click on the thumbnail to load up the main image.
Everything seem to function properly but I get this error "ReferenceError: Error #1069: Property name not found on flash.display.LoaderInfo and there is no default value.
at galleryXML_fla::MainTimeline/imageLoaded()
"

Here's the Code



var thumbLoader:Loader;
var imageLoader:Loader = new Loader();
var imageText:TextField = new TextField();
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
var xmlRequest:URLRequest = new URLRequest("gallery.xml");
xmlLoader.load(xmlRequest);

imageLoader.contentLoaderInfo.addEventListener(Pro gressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, imageLoaded);
xmlLoader.addEventListener(Event.COMPLETE, thumbLoaded);
mPreloader.visible = false;

function imageLoading(event:ProgressEvent):void {
mPreloader.visible = true;
var loaded:Number = event.bytesLoaded / event.bytesTotal;
var percent:int = loaded * 100;
mPreloader.tLoaderInfo.text = percent;
setProg(loaded);
}

function setProg(val:Number) {
mPreloader.mProgress.width = val*mPreloader.mBase.width;
}

function thumbLoaded(event:Event):void {
xml = XML(event.target.data);
xmlList = xml.children();
for (var i:int = 0; i < xmlList.length(); i++) {
thumbLoader = new Loader();
thumbLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
thumbLoader.x = i * 80 + 20 ;
thumbLoader.y = 25;
thumbLoader.name = xmlList[i].attribute("source");
trace(thumbLoader.name);
addChild(thumbLoader);
thumbLoader.addEventListener(MouseEvent.CLICK, imageLoaded);
mPreloader.visible = false;
}

}

function imageLoaded(event:Event):void {
mPreloader.visible = false;
imageLoader.load(new URLRequest(event.target.name));
imageLoader.x = 50;
imageLoader.y = 100;
addChild(imageLoader);
imageText.x = imageLoader.x;
imageText.y = 600;
for (var j:int = 0; j < xmlList.length(); j++) {
if (xmlList[j].attribute("source") == event.target.name) {
imageText.text = xmlList[j].attribute("title");
}
}
}
imageText.autoSize = TextFieldAutoSize.LEFT;
addChild(imageText);




Thanks

vxd

bzouchir
October 5th, 2008, 10:16 AM
the imageLoaded is listening to imageLoader.contentLoaderInfo:

imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, imageLoaded);

so when a event.COMPLETE is dispatched, in imageLoaded you are calling
...
if (xmlList[j].attribute("source") == event.target.name) {
...

the event.target.name = loader.contentLoaderInfo.name
and LoaderInfo class does not have a name attribute that's why you're getting this error

try instead
event.currentTarget.name to get the name

hope that helps

vxd
October 5th, 2008, 09:25 PM
I tried it but the same problem problem occurred.

vxd
October 6th, 2008, 08:25 AM
I don't think it has to do with anything with
if (xmlList[j].attribute("source") == event.currentTarget.name) { because when I get rid of it the problem is still there.

bzouchir
November 5th, 2008, 06:07 AM
If you are still having this issue, zip your source code with the xml and I can try and have a look.