Flash Tutorials

XMLStyleMellowBlueMonkey

Movie Functions

Skill Level: Intermediate
Knowledge Needed: Movie Clips, Actionscripting
Number of Steps: 5
The Movie
-----------------------------------------------

------------------------------------------------
Download Flash File

Spreadshirt
Picture 1
Step First what you need to do is make or import your graphic which you want to mutilate. Select the image, then make a new movie clip by going to Insert>Convert To Symbol. Select "movie clip" and name it anything you would like, I called mine "logo". (You can click the image on the left to get a larger view.)

Picture 2
Step Select the movie clip which you made, and go to the Instance tab, similar to what it looks like on the left. Name it "box". Then, go to the top of the screen on top to the timeline, right click on the first frame, and choose "Actions". In there, write the following code, you can copy paste it if you would like:
tellTarget ("box") {
    ..:x = _x;
    ..:rotation = _rotation;
    ..:y = _y;
    ..:alpha = _alpha;
    ..:xscale = _xscale;
    ..:yscale = _yscale;
} 

Picture 3
Step The next thing you want to do is make the funky buttons for the up and down arrows. Mine are really basic ones, but you can get intricate and make them neat looking =p. After you're done making them, select the up arrow, and go to Insert>Convert to Symbol. Name it "up" and make behavior as a button. Go back and select the down arrow and again go to Insert>Convert to Symbol, name it "down" with behavior as a button.

Picture 4
Step Now, right click the "up" button and select "Actions". Write in or copy-paste the following code:
on (release) {
    tellTarget ("box") {
        _x+=10;
        ..:x = _x;
    }
}
 
Go back, and right click on the "down"button and select "Actions". Write in or copy-paste the following code:
on (release) {
    tellTarget ("box") 
        _x-=10;
        ..:x = _x;
    }
} 

Picture 5
Step The last step sets up moving the box to the left and to the right. If you want to do other effects like move it up and down, rotate, etc, repeat step 3 to make the button, and then plug in the following codes for each respective effect:

Moving Code: Up Arrow Code:
	on (release) {
    tellTarget ("box") {
        _y-=10;
        ..:y = _y;
    }
}
	
Down Arrow Code:
	on (release) {
    tellTarget ("box") {
        _y+=10;
        ..:y = _y;
    }
}
	
Rotating clockwise and counterclockwise: Up Arrow Code:
	on (release) {
    tellTarget ("box") {
        _rotation+=10;
        ..:rotation = _rotation;
    }
}
	
Down Arrow Code:
	on (release) {
    tellTarget ("box") {
        _rotation-=10;
        ..:rotation = _rotation;
    }
}
Increase and Decrease the Width: Up Arrow Code:
	on (release) {
    tellTarget ("box") {
        _xscale+=10;
        ..:xscale = _xscale;
    }
}
	
	
Down Arrow Code:
	on (release) {
    tellTarget ("box") {
        _xscale-=10;
        ..:xscale = _xscale;
    }
}
Increase and Decrease the Height: Up Arrow Code:
	on (release) {
    tellTarget ("box") {
        _yscale+=10;
        ..:yscale = _yscale;
    }
}
	
Down Arrow Code:
	on (release) {
    tellTarget ("box") {
        _yscale-=10;
        ..:yscale = _yscale;
    }
}
Increase and Decrease the Alpha/Opacity: Up Arrow Code:
	on (release) {
    tellTarget ("box") {
        if (_alpha+10<100) {
            _alpha+=10;
            ..:alpha = _alpha;
        }
    }
}
	
Down Arrow Code:
on (release) {
    tellTarget ("box") {
        if (_alpha-10>0) {
            _alpha-=10;
            ..:alpha = _alpha;
        }
    }
}
Whew, that was tiresome but your "box" should be fully functional and ready to go now. If you want to display the values like I did on the bottom right, just make a dynamic text box, and define the variables as: x, y, rotation, xscale, yscale, and alpha respectively. Hope this tutorial helps in explaining the vast functions of movies and if you need any help, just drop us an e-mail in the contact section.

Discuss this tutorial »
Written by: Akash Goel
Back to Flash TutorialsTop


Copyright © 2000-2010 Spoono, LLC. All rights reserved.
Network: Reseller Web Hosting by Spoono Host | Spoonloads | Absolute Cross
Terms of Service | Privacy Policy.

kdfj