Je tente en vain de donwloader dynamiquement une dizaine de .PNG, car le complilateur me retourne l'erreur suivante:
Citation
TypeError: Error #1006: value is not a function.
at untitled_fla::MainTimeline/pngLoaded()
at untitled_fla::MainTimeline/pngLoaded()
Alors que lorsque je le fais à l'unité cela fonctionne.
Action Script
var xmlThumbLoadedCounter:uint=0;
var pngLdr:Loader = new Loader();
var pngURL:String;
var pngURLReq:URLRequest;
function loadPNGThumb_fct(which:int):void {
pngURL = xmlArray[which];
pngURLReq = new URLRequest(pngURL);
pngLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, pngLoaded, false, 0, true);
pngLdr.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
pngLdr.load(pngURLReq);
}
function onIOError(evt:IOErrorEvent) { trace("IOError: "+evt.text); }
function pngLoaded(evt:Event):void {
this["thumb"+xmlThumbLoadedCounter+"_sp"].addChild(evt.target.content);
xmlThumbLoadedCounter++;
}
Donc:
Action Script
this["thumb"+xmlThumbLoadedCounter+"_sp"].addChild(evt.target.content);
Ne fonctionne pas, non plus:
Action Script
var tmpName:String = "thumb"+xmlThumbLoadedCounter+"_sp";
tmpName.addChild(evt.target.content);
Alors que manuellement:
Action Script
thumb4_sp.addChild(evt.target.content); // '4' étant un exemple
Fonctionne… Je deviens fouuuuu!
Où est mon erreur, SVP?