Miroku_87
17-04-2010, 18:32
Ciao a tutti,
ho questo problema:
In base ad un XML creo una galleria di immagini grazie a un for che genera tanti UILoader quanto detto nell'xml e vi inserisce dentro le immagini jpg tramite gli url scritti sempre nell'xml.
Ora a me serve ricavare l'url dell'immagine presente nell'UILoader sul quale l'utente clicca.
Ho provato a fare cosė:
var xmlImg:XML = new XML(e.target.data);
var thumbW:uint = xmlImg.attribute("thumbWidth");
var thumbH:uint = xmlImg.attribute("thumbHeight");
for(var i:uint; i < xmlImg.img.length(); i++){
req = new URLRequest(xmlImg.img[ i ].path);
thumbnail = new UILoader();
thumbnail.load(req);
thumbnail.x = 0;
thumbnail.y = i*thumbH;
thumbnail.setSize(thumbW,thumbH);
thumbnail.addEventListener(MouseEvent.MOUSE_OVER, zoom);
thumbnail.addEventListener(MouseEvent.CLICK, imgChange);
addChild(thumbnail);
}
function zoom(e:MouseEvent){
}
function imgChange(e:MouseEvent){
trace(e.target);
}
Il trace restituisce [Object Loader] che č diverso dall'UILoader e che quindi non ha pių l'attributo source, ma l'attributo content... che mi restituisce [Object Bitmap] e anche da questa classe non riesco a trovare un modo per ricavare l'url dell'immagine cliccata....
come posso fare?
Grazie in anticipo ^^
ho questo problema:
In base ad un XML creo una galleria di immagini grazie a un for che genera tanti UILoader quanto detto nell'xml e vi inserisce dentro le immagini jpg tramite gli url scritti sempre nell'xml.
Ora a me serve ricavare l'url dell'immagine presente nell'UILoader sul quale l'utente clicca.
Ho provato a fare cosė:
var xmlImg:XML = new XML(e.target.data);
var thumbW:uint = xmlImg.attribute("thumbWidth");
var thumbH:uint = xmlImg.attribute("thumbHeight");
for(var i:uint; i < xmlImg.img.length(); i++){
req = new URLRequest(xmlImg.img[ i ].path);
thumbnail = new UILoader();
thumbnail.load(req);
thumbnail.x = 0;
thumbnail.y = i*thumbH;
thumbnail.setSize(thumbW,thumbH);
thumbnail.addEventListener(MouseEvent.MOUSE_OVER, zoom);
thumbnail.addEventListener(MouseEvent.CLICK, imgChange);
addChild(thumbnail);
}
function zoom(e:MouseEvent){
}
function imgChange(e:MouseEvent){
trace(e.target);
}
Il trace restituisce [Object Loader] che č diverso dall'UILoader e che quindi non ha pių l'attributo source, ma l'attributo content... che mi restituisce [Object Bitmap] e anche da questa classe non riesco a trovare un modo per ricavare l'url dell'immagine cliccata....
come posso fare?
Grazie in anticipo ^^