Some serious actionscript help, related to MX

Hi everyone. I’m new. I’ve been seeking ehlp with this for a week at Flashkit. Maybe someone here could/would be willing to help. I asked a how to at Flashkit and someone coded it for me. Efforts to contact this person regarding explanation of how it works and to help make a few more changes have been in vain.

It’s a disappearing menu, created with actionscript, and I want to understand HOW it works and how to make it do what I want (which is load an MC that corresponds with which button was pressed AFTER the menu animation is complete).

Maybe this is a more insane challenge than I thought? My efforts to decode the actionscript and rebuild it have been in vain as I don’t undertand what some of the variables mean. I’m not new to flash, but new to complex actionscripting.

Anyway, here are the pertinent links.
http://www.seedrecords.net/clock-UG.swf (The animation currently happens too soon. Also the console is just a rough one at this point).
http://www.seedrecords.net/clock-UG.zip (the FLA file).

Drop me a line if you can/are willing to help.

J

i’d help, but you put the swf in the zip instead of the fla…rob

I can’t believe I did that. Maybe that’s why everyone at Flashkit was ignoring my pleas for help…

Anyway, It should be ok now. The ZIP File should contain the fla and the swf.

Let me know if you get it. In fact if anyone is working on it, please let me know…

Thanks again!

J

Anyone at all? hmm… maybe this is more insane than I figured…?? If anyone at all is workin on it, please let em know, ok?

J

so what do you want to know? if you want to load a movie clip after each button is pressed you dont really have to understand the code that was written for you. Just put a load movie onRelease() action on each button. Then, so it doesnt come in too soon you could pause its time line to corrispond with how long it takes the buttons to animate away. You could do it many ways, but it doesnt really require that you disect the script written for you. but…
The code just uses a counter variable k to to determine the order in which to fade. If you click on the button that has code fadeOut(3) then the function fades the alpha of 3 then k++ which is 4 then k++ which is 5… etc. Hope this helps you look at the code a little better.

I found a work-around for the movie clip (screen-wipe) which is telling it to play after the menu button appears. That works ok. Now I want to add a condition that checks if the screen-wipe is done playing, then references which button was pushed and loads a movie-clip.

Can this be done?

The script doesn’t have to be disected, but I just want to understand it. I get the basic premise of your explanation.

I guess my learning has been “hodge-podge” so I don’t really understand the equations but I get the k++ thing… though I don’t know how it knows what to do after button 8 if I press, say, button 4 first.

Do you know what I mean?

J

as for checking if the screen wipe is done just make a variable like wiped and have it set to false. Then when screenWipe finishes have wipe set to true, then you can check this with an if(wipe=true){ then do all the stuff here}
else { otherwise do this}

Using the the same idea you can track your buttons… another variable such as buttonHit = “section it goes to” then you can load the propper MC reading it:
if (buttonHit = section1 ) {
loadMovie(section1MC)
else if (buttonHit = section2){
loadMovie(section2MC)… etc, etc.

As for your question regarding the code already written for you:
if you look at the script there is also a var ‘d’ in there… it gets a value depending on what button was hit first then when the counter started. so if 4 is hit d becomes 8-5 (buttond id-k) which is 3… exactly how far the animation needs to go until all are gone.
Im shooting from the hip on this one, I havent looked at the fla in a while, but I am quite sure this is how they wrote it.

I see! Now the buttons in the FLA set a varibale number for startFadeIn. Can I use that info or should I set a new variable?

J

what are you intending on using that info for? Those numbers tell the script how to fade in, so if youre talking about using them to direct content I’d say no - define a new variable, is this what you meant, your question was a little unclear to me

Sorry, that is what I meant.

Thanks so much for taking the time…

J

Not a problem, if anything else comes up just post away.

Peace

Can I load a Movie Clip (not an external swf) into a blank movie clip? I want my sections to change using the variables mentioned above and then to load the clip into the blank movie. Can this be done?

J

Let me see if I follow: you want an MC (that is in your library - important) to be loaded into a blank MC - also the movie clip that loads into the blank would be dependent on your section defined variables?

if this is the case… you could do this:
creat the blank movie clip with the same number of frames as you have movie clips to load into it (plus add an extra for ‘blank’). Then put a stop action in each key frame, put the appropriate MC on the stage and give that frame a corrisponding lable. Now add a tell target code to your section button:

onRelease(){
_root.blankMC(gotoStop “frame lable”)
}

then if you have a home button or you want the movie clip to dissapear add this to the corrisponding button:

onRelease(){
_root.blankMC(gotoStop “blank”)
}

Using this method you are not really loading anything but specifing which movie clip is visable in the blank MC via indicating the frame lable for it. I hope this is clear - also that it is what you are trying to do… let me know.

That’s pretty much what I want to do. Questions beyond that…

I want it to choose the frame based on the buttonId, after the wipe animation plays. I have the animation playing when I want it to, not I just need a “working” if statement to check first if wipe = false (frame 1) or true (frame 10). It seems to not work. Can I use a looping statement instead of an if statement with 3 frames?

Also, can I have the buried MC’s set up to have pre-loaders so that the whole thing doesn’t have to be loaded before it launches? I’m trying to keep this very small and will soon be adding graphics… jpeg are still the smallest right?

J

ok… in your wipe MC you need to put these actions in your fram 1 and 10 respectively:
(frame 1)
wipe=“false”
(frame 2)
wipe=“true”
This tells the movie clip to set wipe as listed when that frame is reached. Then you put your script to check it where you need it… it would look like this:
if(wipe=“true”){
do all this stuff;
}
else{
do this instead;
}

I dont know what you want the if statement to control so fill me in if you need help with that part. As for as giving each MC a preloader: if you are loading .swf files of MCs it is possible… otherwise your entire flash site will be streamed including all MCs in the library. In order to do what you are talking about you could make each one of your MCs a seperate .swf put a preloader at the beginning and then have it loaded using the loadMovie() function. This is how most flash sites are constructed to begin with, and like you mentioned it really helps cut down on the size.

I hope I touched on everything. Let me know.

Peace