Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Instances

Status
Not open for further replies.

RandalGroves

Programmer
Apr 17, 2002
7
GB
Ive got a movie clip called cover, ive dragged 6 instances of this movieclip onto my main movie and named them CoverA through to CoverF.

You can click on each one and it takes you to a certain frame in the Cover movie, what I need to know is while in the animation tha cover has is there anyway to tell what cover was clicked to get here (ie was coverA pressed or CoverC).

I want to know this as I want to try and disable another cover from being click in the main move depending on what cover has just been click, if coverA has been click I want to disable coverB, while if coverD has been click I want to disable coverC.

Any help to start me in the right direction will be gratefully accepted.

Thanks
 
This would somewhat be easier with Flash MX, because you can now disable a button very easily, in MX.
Guess you can also do it in Flash 5 but it will envolve a little more scripting.
I'd use a variable, let's say _level0.current_sel and use in if statements (on your button scripts), in the same manner I often used this to keep actions from being performed again when pressing a given button, a second time.
The script usually looks something like this:

on (press){
if ( _level0.current_sel == "coverA"){
stop();
}else{
// do_something;
_level0.current_sel = "coverA";
}
}

So what this script does is first check if the current selection is equal to coverA, and if it is, stops any action from beeing performed. If not equal, it then does something and sets the current selection to coverA. The tricky part with this is that at some point in the do_something you would normally have to clear the value of the current selection variable, if you want to re-enable coverA button. Until the current selection is cleared or change by another button, button coverA will remain disabled.

You might have to use several variables, depending on how many buttons you have, but that's the direction I would take.

Will be out for most of the rest of the day, but will then check in to see if you need more help, and no one has made any other workable proposition.

Regards,
new.gif
 
Is there a way to get a variable to record what the current instance is, so I could do something like :-

if (currentInstance == "coverA"){
\\disable coverB
}
else
if (currentInstance == "coverB"){
\\disable coverA
}
else
if (currentIntansce == "coverC"){
\\disable coverD
}

and so on.....
so basically when one of the instances is pressed in the main movie I need to know which instance was pressed so I can disable the revelant button (all the Cover movie clip as is a button and a small anamtion).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top