Hi
I wanna make a gallery using xml. Every photo is gray, after ROLL_OVER on it position loads it’s colored copy, and after ROLL_OUT copy dissapears. After click, it should navigate to URL. And I have 2 problems:
- ROLL_OUT doesn’t work correctly: it’s strange, but it work after ROLL_OVER … :<
- how to make linking, hm… for example, if it’s first thumb, to “proj/1”, if second to ‘proj/2’ etc…
it’s my code:
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.Loader;
import fl.transitions.Tween;
import fl.transitions.easing.*;
var imageLoader:Loader;
var szary = new Loader();
var xml:XML;
var xmlList:XMLList;
var fadeTween:Tween;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("images.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for (var i:int = 0; i < xmlList.length(); i++)
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList*.attribute("thumb")));
imageLoader.x = i * 167;
imageLoader.y = 0;
imageLoader.name = xmlList*.attribute("source");
addChild(imageLoader);
imageLoader.addEventListener(MouseEvent.CLICK, onClick);
imageLoader.addEventListener(MouseEvent.ROLL_OVER, color);
imageLoader.addEventListener(MouseEvent.ROLL_OUT, gray);
}
}
function color(event:MouseEvent):void
{
szary.load(new URLRequest(event.target.name));
szary.x = event.target.x;
fadeTween = new Tween(szary,"alpha",Regular.easeOut,0,1,1,true);
addChild(szary);
}
function gray(event:MouseEvent):void
{
trace('s')
}
function onClick(event:MouseEvent):void
{
var link:URLRequest = new URLRequest('proj/1/01.jpg');
navigateToURL(link);
}
thank You in advance!