Hey everyone. Let me start off by saying that although I design in flash
often, my knowledge of ActionScript is limited at best. I am typically a
graphic artist, using Adobe CS2 etc.
That said, I have been involved in the updating of a site that uses a
Sequential Thumbnail Loader. In the part of the code that I'm trying to
change, the thumbnails are loaded, and then tweened onto the stage. I have
created a graphic loader myself, outside of the script, but it is completely
disconnected from any bytes loaded; simply put it's there for show atm.
What I'm trying to find out is, can I have the script begin to load at the
start of the timeline, then pause the script until my movie clip finishes, then
tween in the thumbnails? I know on paper this seems pretty easy, but the block
of code determining the entrance of the images is this:
tmclL.onLoadInit = function() {
tcount +=1;
if (tcount<thumbs.length) {
loadThumb(tcount);
}
else {
removeMovieClip("thumbLoading");
p1w = myPanel1._width;
p2w = myPanel2._width;
pt = -(((p1w + p2w + thumbPad) - myMask1._width) - maskX * 2);
myPanel2._x = Math.round(p1w+maskX+thumbPad);
var tw10:Tween = new Tween(myPanel1, "_y", Back.easeOut, myPanel1._y,
maskX+0, 1, true);
var tw11:Tween = new Tween(myPanel2, "_y", Back.easeOut, myPanel2._y,
maskX+0, 1, true);
tw11.onMotionStopped = function() {
myPanel1.onEnterFrame = scrollUp;
myPanel1.onRollOver = myPanel2.onRollOver = panelOver;
}
loadImage(images[0]);
}
}
I have tried inserting my own "if" statements with little luck, so if anyone
could provide me with some insight, I would be [i]hugely[/i] appreciative.
Thanks!
GWD - 29 Mar 2008 11:33 GMT
Yes, you can do that, but it's a little difficult to advise you the best way
with the information provided:
Can you clarify:
Do you want to play the main clip while the thumbs continue to load... or do
you want to preload the thumbs, then play the main clip, then do the tweening
when the main timeline reaches the end? This way is easy enough.
If you want them to continue to load and then do the tweening at the end of
the main timeline (e..g with a stop() on the last frame) then its also not
complicated, but you need to cover the situation where the loading of the
thumbs may not yet have completed by that time (perhaps the risk is low if the
timeline is long, but its a sensible thing to address regardless).
Also consider whether you want anything to be hidden (i.e. _visible=false) at
any point - e.g. before the thumbs have finished loading.
As a starting point I suggest you would probably put the code after
removeMovieClip("thumbLoading");
and before the next curly bracket (" } ") in a separate function on the main
timeline, e.g.
function tweenThumbs(){
//code here
}
what you would do next depends on the answers to the above questions.
ChartresFraiche - 31 Mar 2008 21:06 GMT
GWD- thanks for your response, sorry it has taken me so long to get back on.
So the second option (load the images while the main timeline is playing) is
what I am trying to accomplish. The timeline is about 6 seconds long, and
there are only 8 or 9 images to preload; usually they finish as soon as my
timeline is complete actually.
The problem is, once someone has the images stored in their cache, they load
much more quickly, and so they tween in after about the 2nd or 3rd second.
Also, nothing needs to be hidden, per-se, but if it makes it easier for our
code, I can make the main logo (part of my timeline) become hidden.
Do you have any idea how to create the code necessary to attach the tween
function to the end of my timeline? I'm sure it's possible, and even easy, but
to be honest, it's completely beyond me at this point.