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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you chage the instance of only one symbol

Status
Not open for further replies.

avinsinanan

Programmer
Jul 14, 2002
92
0
0
TT
Hello I know is may sound like a stupid question, But here I go anyway.

Ok lets say I have a Button called Button1. And I put seven instances of it on the work space, lets assume the buttons are orange. Can I just change only one of the buttons to green without changing the rest?

If you can.. how do you do it?

Thanks

Yours Respcectfully
Avin Sinanan
 
The only way to affect instances independantly is with Action Script. If you use any of the drawing tools for e.g. the change will propogate accross all instances.

Select the button you would like to change and hit F8, this will bring up the 'Convert to Symbol' dialogue box. Leave it on Movie Clip and enter a new clip name. Now you have a button inside a movie clip.

If the clip is not selected then select it and on the actions panel enter:

onClipEvent(load)
{
// initialse new object instance
Col = new Color(this);

// assign values to variables
red = 25;
green = 184;
blue = 200;

// set the RBG colour values to the movie clip instance
Col.setRGB(red<<16|green<<8|blue);
}

You can get the values for red, green and blue from playing with the Color Mixer panel and taking the values from there.

The set setRGB uses bitwise shifing which is a bit wierd and that is why there is <<16 and <<8 in the parameters of the command.

The disadvantage is now you will lose any colour changes that you had for over and down on the button.

 
That's the only way to affect things when they're already on the stage but if you want your button to be green or whatever from the get-go you can duplicate the button symbol in the library and change the colour of the duplicated button then drag it to the stage.

Be careful with this though as, if you have other symbols nested inside the button and you change them they will change in the original button too.
 
OK thanks,

However does the same apply for butons with Text in it?

Eg if I have a button with Text written on it and I want to change the text on only one of the buttons?

Thanks
 
Editing one instance of a button will edit all instances of that particular symbol. You'll thus have to duplicate it again and again (by the way you should renamed them!), and don't forget to drag on stage, a new instance of this duplicated symbol each time, before you edit it! Regards,

oldman3.gif
 
Oldnewbie,

Does this work in Flash 5? Casue I've tried that which you suggested and it does not work.

Thanks for the advice though.

Yours Respectfully
Avin Sinanan
 
Yes! It worked in Flash 5.

You have a red button1 symbol in the Library. You right click it in the Libary, duplicate it and rename it button2. Double-click this new button2 symbol in the Library to go into edit mode. Make whatever changes you want to make, chage it's color to green for example. Return to your scene and drag a new instance of this new green button on stage. You want a third yellow button? Simple just duplicate any of the 2 other symbols, rename it button3, and edit it's color as you just did for button2. Drag a new instance of this button3 on stage.

BUT... If you drag several instances of each button on stage and edit any instance of the red button, for example, all instances of that red button will reflect the change. In other words you don't edit an instance of a symbol, you duplicate the symbol, and edit the symbol itself to create a new symbol, that can be edited without affecting other instances of another similar button. Regards,

oldman3.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top