• 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 World Style

Category : Flash Views : 39716
Version : 8 Rating : 
3.1/5 (50 votes)
  • Currently 3.12/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: xml-image-gallery-with-world-style.zip
Result: See the result


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

Paste the code below for the MCloader and the code for the images.
//Hide the MC that is on the stage as we will just //duplicate it, but not load any image frame._alpha = 0; //Create a MovieClipLoader object to load every image MCloader = new MovieClipLoader(); //This object will create an Event Handler for the //MCloader to warn us when the image is loaded listener = new Object(); //Attach the Event Handler below to the MCloader MCloader.addListener(listener); //This is called when the image is loaded and listener.onLoadInit = function(target) { //Create a new BitmapData object to save the image var bmd:BitmapData = new BitmapData(500,375); //Get the scale of the image so that it has the size "500x375" var xscale = 500/target._width var yscale = 375/target._height //This Matrix is used to scale the //image when we draw it to the bitmap var MT = new Matrix(); //Set the matrix to scale using the value we got above MT.scale(xscale, yscale) //Draw the image to the bitmap and scale it using the matrix. bmd.draw(target, MT); //Loop 5 times to make 5 copies of each image for(i = 0; i < 5; i++) { //Duplicate MC duplicateMovieClip(frame, "frame" + _root.frames, _root.getNextHighestDepth()) //Use the variable "mc" to call this instance from now on mc = _root["frame" + _root.frames] //Create a new MC inside the duplicate mc.createEmptyMovieClip("pic", 10); //Set the position of this new MC, this is where we attach //the image so this position is where the image starts mc.pic._x = -250 mc.pic._y = -187.5 //Attach the BitmapData with the image to the "pic" MC mc.pic.attachBitmap(bmd, 1); //Get random scale between 2% and 7% mc._xscale = mc._yscale = Math.random() * 5 + 2 //Get random rotation between 0º and 360º mc._rotation = Math.random() * 360; //Set the alpha to be proportional //with the scale of the MC mc._alpha = mc._xscale * 20 //Set the position of MC to a random //value anywhere on the stage mc._x = Math.random() * Stage.width; mc._y = Math.random() * Stage.height; //Event Handler for every MC mc.onEnterFrame = function() { //Difference between the mouse position and the center of the stage difX = _xmouse - Stage.width/2 difY = _ymouse - Stage.height/2 //Move the MC proportionally with their scale this._x -= difX * this._xscale / 100 this._y -= difY * this._yscale / 100 //If the mouse is over this MC if(this.hitTest(_root._xmouse, _root._ymouse, true)) { //Ease the scale until 100% this._xscale = this._yscale += (100 - this._xscale) / 15; //Ease the rotation of the MC until 0º this._rotation += (0 - this._rotation) / 5; //Ease the alpha to 100% this._alpha += (100 - this._alpha) / 5; //Bring this MC to the top of the others this.swapDepths(_root.getNextHighestDepth()); } //If the image left the screen by the left if(this._x < 0) { //Move the MC to the other side of the screen this._x += Stage.width; //Get new values for the scale rotation and alpha this._xscale = this._yscale = Math.random() * 5 + 2 this._rotation = Math.random() * 360; this._alpha = this._xscale * 20 } //Same code for the other sides of the screens else if(this._x > Stage.width) { this._x -= Stage.width; this._xscale = this._yscale = Math.random() * 5 + 2 this._rotation = Math.random() * 360; this._alpha = this._xscale * 20 } if(this._y < 0) { this._y += Stage.height; this._xscale = this._yscale = Math.random() * 5 + 2 this._rotation = Math.random() * 360; this._alpha = this._xscale * 20 } else if(this._y > Stage.height) { this._y -= Stage.height; this._xscale = this._yscale = Math.random() * 5 + 2 this._rotation = Math.random() * 360; this._alpha = this._xscale * 20 } } //Increase this variable by one to create new names for the duplicates _root.frames++ } //Remove the MC that was used to load the image as we wont use it again target.removeMovieClip(); }


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | 3 | 4 | 5 | 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.