• Home
  • Free Tutorials
  • Free Video Tutorials

Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

XML Image Gallery with Falling Pictures (Snow Effect)

Category : Flash Views : 34363
Version : 8 Rating : 
3.7/5 (62 votes)
  • Currently 3.69/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: xml-image-gallery-with-falling-pictures.zip
Result: See the result


Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next

The last thing for this part of the code is to get a random direction for every "frame" MC:
//Random number between -1 and 1 var dir = Math.random() * 2 - 1; //The code below will run if "dir" equals to 0 and will run until "dir" is different than 0 while(dir == 0) { //Get another random number until its different than 0 dir = Math.random() * 2 - 1; }

Now we just need to code the MC, so open the actions for the "frame" MC's instance and paste:
onClipEvent(load) { //Import libraries need for the animation import mx.transitions.Tween; import mx.transitions.easing.*; //Create a function called "reset()" to reuse the code below when necessary function reset() { //Random scale between 3 and 9 this._xscale = this._yscale = Math.random() * 6 + 3; //Random alpha 50 to 100 this._alpha = Math.random() * 50 + 50; //Rotation 0º to 360º this._rotation = Math.random() * 360; //Random position above the stage, between -200 and -100 this._y = Math.random() * 100 - 200; //Random position for the _x coordinate this._x = Math.random() * Stage.width; //Get random _y speed, 2 to 7 yspeed = (Math.random() * 5 + 2); //Random _x speed, 1 to 5. Speed will be negative if the variable "dir" is negative xspeed = (Math.random() * 4 + 1) * _root.dir; //Whether this image is selected or not select = false; } //Call the function "reset()" for the first time reset(); }

The MC won't fall yet, so paste this:
onClipEvent(enterFrame) { //If the images are loaded and this MC is not selected if ((!select) && (_root.ready)) { //Move on the _x coordinate this._x += xspeed; //Move on the _y coordinate this._y += yspeed; } //If this MC left the screen in any direction, call the function reset() if(this._y > Stage.height) { reset(); } if(this._x < -50) { reset(); } if(this._x > Stage.width + 50) { reset(); } }


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next
How to Video Tutorials on software by Helpvids.com

Video tutorial: Forex trading



Sponsors



Advertisement









Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.