XML grid gallery not loading full images(except for one)
hi,
i created first flash website, 1 of xml image galleries not working properly. using same (code, layout, different pics , xml files) gallery on 4 of pages, however, one("products") of 4 not load "full" images. thumbnails load, decrease opacity when moused over, once click on one, progress bar loads till complete , stops. can see problem in action atwww.erikhigbee.com on "products" page. problem, however, occurred after hosted on ipage.com. when test (ctrl+enter) in flash, test in dreamweaver or open .html of computer, works perfectly. after ftp upload files ipage's server problem occurs. made sure keep filetree same , everything. problem ipage? many images trying load??
furthermore, odd reason 1st image(left), 4th row down on s"products" page load full image others still dont , can't life of me figure out why. code same on other pages.
thanks , help/advice can give me!
one thought(from posts on other forums) inefficient code. error #2044: unhandled ioerrorevent:. text=error #2036: load never completed. pops whenever thumbs clicked. idk if helps.
below code used gallery. take quick on , see if problems/inefficiencies jump out @ ya??
[code]import flash.net.urlloader;
import flash.net.urlrequest;
import flash.events.event;
import flash.display.movieclip;
import flash.display.loader;
import flash.events.mouseevent;
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 container_mc:movieclip;
var preloaders_mc:movieclip;
var full_mc:movieclip;
var x_counter:number = 0;
var y_counter:number = 0;
var my_tweens:array = [];
var container_mc_tween:tween;
var full_tween:tween;
var myxmlloader:urlloader = new urlloader();
myxmlloader.load(new urlrequest("gallery_hats.xml"));
myxmlloader.addeventlistener(event.complete, processxml);
function processxml(e:event):void{
var myxml:xml = new xml(e.target.data);
columns = myxml.@columns;
my_x = myxml.@xposition;
my_y = myxml.@yposition;
my_thumb_width = myxml.@width;
my_thumb_height = myxml.@height;
my_images = myxml.image;
my_total = my_images.length();
createcontainer();
callthumbs();
myxmlloader.removeeventlistener(event.complete, processxml);
myxmlloader = null;
}
function createcontainer():void{
container_mc = new movieclip();
container_mc.x = my_x;
container_mc.y = my_y;
addchild(container_mc);
container_mc.addeventlistener(mouseevent.click, callfull);
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; < my_total; i++){
var thumb_url = my_images[i].@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)*y_counter;
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;
preloader_pb.width = my_thumb_width;
preloader_pb.height = my_thumb_height/10;
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);
}
function callfull(e:mouseevent):void{
var full_loader = new loader();
var full_url = my_images[e.target.name].@full;
full_loader.load(new urlrequest(full_url));
full_loader.contentloaderinfo.addeventlistener(event.init, fullloaded);
var full_pb:progressbar = new progressbar();
full_pb.source = full_loader.contentloaderinfo;
full_pb.x = (stage.stagewidth - full_pb.width)/2;
full_pb.y = (stage.stageheight - full_pb.height)/2;
preloaders_mc.addchild(full_pb);
full_pb.addeventlistener(event.complete, donepb);
container_mc.removeeventlistener(mouseevent.click, callfull);
container_mc.buttonmode = false;
container_mc.removeeventlistener(mouseevent.mouse_over, onover);
container_mc.removeeventlistener(mouseevent.mouse_out, onout);
container_mc_tween = new tween(container_mc, "alpha", strong.easein, 1,0.5,0.5, true);
}
function fullloaded(e:event):void{
full_mc = new movieclip();
full_mc.buttonmode = true;
addchild(full_mc);
var my_loader:loader = loader(e.target.loader);
full_mc.addchild(my_loader);
full_tween = new tween(my_loader, "alpha", strong.easein, 0,1,0.5, true);
my_loader.x = (stage.stagewidth - my_loader.width)/2;
my_loader.y = (stage.stageheight - my_loader.height)/2;
my_loader.addeventlistener(mouseevent.click, removefull);
my_loader.contentloaderinfo.removeeventlistener(event.complete, fullloaded);
}
function removefull(e:mouseevent):void{
var my_loader:loader = loader (e.currenttarget);
full_tween = new tween(my_loader, "alpha", strong.easeout, 1,0,0.5, true);
full_tween.addeventlistener(tweenevent.motion_finish, tweenfinished);
container_mc_tween = new tween(container_mc, "alpha", strong.easeout, 0.5,1,0.5, true);
}
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{
var my_loader:loader = loader (e.target.obj);
my_loader.unload();
full_mc.removechild(my_loader);
removechild(full_mc);
full_mc = null;
container_mc.addeventlistener(mouseevent.click, callfull);
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.5;
}
function onout(e:mouseevent):void{
var my_thumb:loader = loader(e.target);
my_thumb.alpha = 1;
}
[/code]
More discussions in ActionScript 3
adobe
Comments
Post a Comment