Preloading vs. local testing
i'm working on site loads in xml data , various stuff it. when deployed on web have loader loads both , data while showing progress bar kind of thing.
the idea not let whole thing start until data , entire contents loaded. , working. loader swf 26k , has loader content.swf , 1 xmldata , when both loaded casts loader.content movieclip , addchilds it. creates xml loaded data , adds property of content movieclip.
and content has added stage event listener let know added stage , should start working data , showing folks buttons, etc.
the trick comes when want test locally want of time without having go trouble use loader , that.
when swf main timeline doesn't recieve added stage event. function gets started when used in loader never gets called. bits of code sort of outline how things going.
addeventlistener(event.added_to_stage,checkxml);
if(stage!=null){
// testing locally
checkxml(null);
}
function checkxml(e:event){
if(xmldata==null){
// didn't xmldata loader need load now
} else {
// got xmldata preloader process , going
}
}
does seem sensible? there other way make more sense? have suggestions?
there's more flexibility , it's practice use config constants. have used before?
More discussions in ActionScript 3
adobe
Comments
Post a Comment