Question
basic movie clip loader and load vars question
Hello,
I'm a designer who knows only the most basic Action Script, so i'm muddling through a fairly big project and learning as i go. I'm using AS2, mostly, though my version of Flash is CS3 (i just don't know any AS3 at all to know where to begin, so i'm publishing all swfs with AS2).
The thing that's throwing me off is that all info in the site -- jpeg thumbnails, text labels -- need to be easily changed outside Flash. I need to use MovieClipLoaders and LoadVars to keep all text and jpeg elements as external files. The IT guy at the company i'm doing the site for needs to be able to swap out thumbnails and text info whenever he needs to update the site, and he doesn't know Flash at all.
So, the first problem is that i am loading multiple jpegs into different containers. i basically have 12 containers in one fla file. I need to keep them in separate containers because they need to animate individually. So here is the code on the first frame:
stop();
var myMCL:MovieClipLoader = new MovieClipLoader();
myMCL.addListener(this);
myMCL.loadClip("homePage/images/HPthumb1.jpg", "container1");
myMCL.loadClip("homePage/images/HPthumb2.jpg", "container2");
myMCL.loadClip("homePage/images/HPthumb3.jpg", "container3");
myMCL.loadClip("homePage/images/HPthumb4.jpg", "container4");
myMCL.loadClip("homePage/images/HPthumb5.jpg", "container5");
myMCL.loadClip("homePage/images/HPthumb6.jpg", "container6");
myMCL.loadClip("homePage/images/HPvideothumb1.jpg", "containerV1");
myMCL.loadClip("homePage/images/HPvideothumb2.jpg", "containerV2");
myMCL.loadClip("homePage/images/HPvideothumb3.jpg", "containerV3");
myMCL.loadClip("homePage/images/HPvideothumb4.jpg", "containerV4");
myMCL.loadClip("homePage/images/HPvideothumb5.jpg", "containerV5");
myMCL.loadClip("homePage/images/HPvideothumb6.jpg", "containerV6");
function onLoadInit(mc:MovieClip) { trace("content has been loaded into "+mc);
gotoAndPlay("start");
}
i just want all the MCs to load on the first frame, even if they're not visible, so i can call on them later in the movie. i also want the playhead to freeze there while everything loads and then move to my "start" label frame once ALL MCs are loaded. i added a listener to do this. BUT it seems the listener works when ANY movie clip is loaded. so it means as each one loads, the playhead goes to "start" over and over again, kind of stuttering.
Is there a way to use a Listener to listen to when ALL movie clips have finished loading, and only then go to a specific frame?
My second problem is that I have a text MC that follows the user's mouse. I would like it to load in dynamic text from an external text file. The text needs to change depending on the mouse rollover. There are 6 hit areas (thumbnails), and the text changes while it follows the mouse along the 6 hits.
so to do this i have the following script on each hit :
on (rollOver) {
this.gotoAndPlay("thumb1");
label1.menuLabel = "LABEL1";
So here, for example, the menu label, "LABEL1" is for the first thumbnail, and would change to something else when the rollover goes to another thumbnail. Each hit has its own code similar to the above.
on the scrolling text itself i have the following code:
onClipEvent (enterFrame) {
//x movement
mx=_parent._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=Math.round(_x-moveSpeedx);
}
else {
_x=Math.round(_x+moveSpeedx);
}
}
...so that the text MC follows the user's mouse.
This works fine, but it doesn't have dynamic text, because the moving text MC has to be a single MC for the effect to work. In other words, I would normally make a sequence of 6 MCs that have LoadVars and dynamic text, but I can't do that in this case. How do I load the text into one MC dynamically so that the text changes with every rollover?
I would HUGELY appreciate any help!
thanks very much!
I'm a designer who knows only the most basic Action Script, so i'm muddling through a fairly big project and learning as i go. I'm using AS2, mostly, though my version of Flash is CS3 (i just don't know any AS3 at all to know where to begin, so i'm publishing all swfs with AS2).
The thing that's throwing me off is that all info in the site -- jpeg thumbnails, text labels -- need to be easily changed outside Flash. I need to use MovieClipLoaders and LoadVars to keep all text and jpeg elements as external files. The IT guy at the company i'm doing the site for needs to be able to swap out thumbnails and text info whenever he needs to update the site, and he doesn't know Flash at all.
So, the first problem is that i am loading multiple jpegs into different containers. i basically have 12 containers in one fla file. I need to keep them in separate containers because they need to animate individually. So here is the code on the first frame:
stop();
var myMCL:MovieClipLoader = new MovieClipLoader();
myMCL.addListener(this);
myMCL.loadClip("homePage/images/HPthumb1.jpg", "container1");
myMCL.loadClip("homePage/images/HPthumb2.jpg", "container2");
myMCL.loadClip("homePage/images/HPthumb3.jpg", "container3");
myMCL.loadClip("homePage/images/HPthumb4.jpg", "container4");
myMCL.loadClip("homePage/images/HPthumb5.jpg", "container5");
myMCL.loadClip("homePage/images/HPthumb6.jpg", "container6");
myMCL.loadClip("homePage/images/HPvideothumb1.jpg", "containerV1");
myMCL.loadClip("homePage/images/HPvideothumb2.jpg", "containerV2");
myMCL.loadClip("homePage/images/HPvideothumb3.jpg", "containerV3");
myMCL.loadClip("homePage/images/HPvideothumb4.jpg", "containerV4");
myMCL.loadClip("homePage/images/HPvideothumb5.jpg", "containerV5");
myMCL.loadClip("homePage/images/HPvideothumb6.jpg", "containerV6");
function onLoadInit(mc:MovieClip) { trace("content has been loaded into "+mc);
gotoAndPlay("start");
}
i just want all the MCs to load on the first frame, even if they're not visible, so i can call on them later in the movie. i also want the playhead to freeze there while everything loads and then move to my "start" label frame once ALL MCs are loaded. i added a listener to do this. BUT it seems the listener works when ANY movie clip is loaded. so it means as each one loads, the playhead goes to "start" over and over again, kind of stuttering.
Is there a way to use a Listener to listen to when ALL movie clips have finished loading, and only then go to a specific frame?
My second problem is that I have a text MC that follows the user's mouse. I would like it to load in dynamic text from an external text file. The text needs to change depending on the mouse rollover. There are 6 hit areas (thumbnails), and the text changes while it follows the mouse along the 6 hits.
so to do this i have the following script on each hit :
on (rollOver) {
this.gotoAndPlay("thumb1");
label1.menuLabel = "LABEL1";
So here, for example, the menu label, "LABEL1" is for the first thumbnail, and would change to something else when the rollover goes to another thumbnail. Each hit has its own code similar to the above.
on the scrolling text itself i have the following code:
onClipEvent (enterFrame) {
//x movement
mx=_parent._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=Math.round(_x-moveSpeedx);
}
else {
_x=Math.round(_x+moveSpeedx);
}
}
...so that the text MC follows the user's mouse.
This works fine, but it doesn't have dynamic text, because the moving text MC has to be a single MC for the effect to work. In other words, I would normally make a sequence of 6 MCs that have LoadVars and dynamic text, but I can't do that in this case. How do I load the text into one MC dynamically so that the text changes with every rollover?
I would HUGELY appreciate any help!
thanks very much!
