hi i posted a week back about a problem i am having, i got a lot of help and thank you very much, i am add it again and having some problem figuring this out.
what i want to do is the following.
- add a sprite movie clip i create on top of the thumbnail so i can only see whats in the circle.
i have so it is on the first thumbnail, but it doesn’t repeat? and its not on top of the thumbnail? - add a dynamic text box to either the right or the left side, text comes from the XML file
text is coming from the XML i did a trace(), but the box i cant get it attached to it - go to a page also driven from the XML file
i figured that one out and have it all working!
please help me i think i got more grey hair from this…
Here is the code and i also attached the link to the complete zip of all the file. I see this as a great tutorial for myself if i get this working. Link to files is [URL=“http://www.vivaxone.com/grid/grid.zip”]here
// Import Stuff
import fl.controls.ProgressBar;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var columns:Number;
var my_x:Number;
var my_y:Number;
var my_thumb_width:Number;
var my_thumb_height:Number;
var my_images:XMLList;
var my_total:Number;
var mask_mc:MovieClip;
var container_mc:MovieClip;
var preloaders_mc:MovieClip;
// Zero Counter in X and Y
var x_counter:Number = 0;
var y_counter:Number = 0;
var my_tweens:Array = [];
var container_mc_tween:Tween;
//Setup XML and Process it
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("artists.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
{
var myXML:XML = new XML(e.target.data);
columns = 2;
my_x = 30;
my_y = 30;
my_thumb_width = 100;
my_thumb_height = 100;
my_images = myXML.ARTIST;
my_total = my_images.length();
createContainer();
callThumbs();
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
myXMLLoader = null;
}
function createContainer():void
{
// Mask Container doesnt repeat and is not on top?
mask_mc = mask_mc;
mask_mc.x = my_x;
mask_mc.y = my_y;
addChild(mask_mc);
container_mc = new MovieClip();
container_mc.x = mask_mc.x;
container_mc.y = mask_mc.y;
addChild(container_mc);
container_mc.addEventListener(MouseEvent.CLICK, callURL);
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
container_mc.buttonMode = true;
preloaders_mc = new MovieClip();
preloaders_mc.x = container_mc.x;
preloaders_mc.y = container_mc.y;
addChild(preloaders_mc);
}
function callThumbs():void {
for (var i:Number = 0; i < my_total; i++) {
var thumb_url = my_images*.@THUMB;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.name = i;
thumb_loader.x = (my_thumb_width+10)*x_counter;
thumb_loader.y = (my_thumb_height+10)* i/1.25 ;
if (x_counter+1 < columns) {
x_counter++;
} else {
x_counter = 0;
y_counter++;
}
var preloader_pb:ProgressBar = new ProgressBar();
preloader_pb.source = thumb_loader.contentLoaderInfo;
preloader_pb.x = thumb_loader.x;
preloader_pb.y = thumb_loader.y-4+my_thumb_height/2;
preloader_pb.width = my_thumb_width;
preloader_pb.height = 8;
preloaders_mc.addChild(preloader_pb);
preloader_pb.addEventListener(Event.COMPLETE, donePb);
}
}
function thumbLoaded(e:Event):void
{
var my_thumb:Loader = Loader(e.target.loader);
container_mc.addChild(my_thumb);
my_tweens[Number(my_thumb.name)]=new Tween(my_thumb, "alpha", Strong.easeIn, 0,1,0.5, true);
my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
}
// Call artist URL
function callURL(e:MouseEvent):void
{
var url:String = my_images[e.target.name].@FULL;
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, '_blank');
}
catch (e:Error)
{
trace("Error occurred!");
}
}
function donePb(e:Event):void
{
var my_pb:ProgressBar = ProgressBar(e.target);
preloaders_mc.removeChild(my_pb);
my_pb.removeEventListener(Event.COMPLETE, donePb);
}
function tweenFinished(e:TweenEvent):void
{
container_mc.addEventListener(MouseEvent.CLICK, callURL);
container_mc.buttonMode = true;
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
var my_tween:Tween = Tween(e.target);
my_tween.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
}
function onOver(e:MouseEvent):void
{
var my_thumb:Loader = Loader(e.target);
my_thumb.alpha = 0.75;
}
function onOut(e:MouseEvent):void {
var my_thumb:Loader = Loader (e.target);
my_thumb.alpha = 1;
}