In previous my tutorial Drag and Drop a button in flash you would have seen how to make a button draggable and droppable. In this tutorial you will make a movie clip change its color by dragging and dropping a button on it. Nice to hear ! Follow the steps below to get like that.
Creating a movie clip:
- Create a movie clip with two frames.
- In the first frame, draw a building or anything you like in orange color and add the script ” stop(); ” to the first frame.
- In the second frame, change the color of the building from orange to pink and also add the script ” stop(); ” to the second frame
- Come out of the editing stage by clicking “scene 1”.
- Select the movie clip and give the “Instance name” to the movie clip as “buildings” in the properties window (shortcut key- Ctrl-F3).
- Below is a detailed image of the above words.
Creating two color brushes :
- Create a orange colored brush and convert it to a button. Again convert the button to a “movie clip“. Give the instance name to that movie clip as “orange“
- Create a pink colored brush and convert it to a button. Again convert the button to a “movie clip”. Give the instance name to that movie clip as “pink“
- The brush created by me is shown below.
Adding some scripts :
Add the following script to the orange colored brush (to the button and not to the movie clip).
on (press) {
startDrag("_root.orange");
}
on (release) {
stopDrag();
if (_root.orange._droptarget == "/buildings") {
_root.buildings.gotoandStop(1);
}
}
Add the following script to the pink colored brush (to the button and not to the movie clip).
on (press) {
startDrag("_root.pink");
}
on (release) {
stopDrag();
if (_root.pink._droptarget == "/buildings") {
_root.buildings.gotoandStop(2);
}
}
That’s all your work is over. Press Ctrl+Enter to test the movie.
Sample:
Add your comment 1 Comment so far