• 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 : 42921
Version : 8 Rating : 
3.7/5 (73 votes)
  • Currently 3.66/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

listener.onLoadInit = function(target) {
This is the Event Handler for when the "target" is done loading. The parameter target is the object to where we are loading.

var bmd:BitmapData = new BitmapData(500,375);
Create a new BitmapData with the size you used inside you frame, in my case the size is "500x375".

var xscale = 500/target._width var yscale = 375/target._height
The image we are loading is probably bigger than the size we want so we need to scale it and we need to know the scale.
We just divide the width and height we want by the width and height of the target (the image). The result will be used in the Matrix object so that 1 equals 100%, 0.5 equals 50%, etc.

var MT = new Matrix();
The Matrix object can be used as a parameter in the draw() function of the BitmapData, we need to use it to scale the image.

MT.scale(xscale, yscale);
Set the Matrix to scale using the values we got previously.

bmd.draw(target, MT);
Draw the Bitmap with the target and the properties of the Matrix.

for(i = 0; i < 10; i++) {
Loop ten times to make ten copies of the same image.

duplicateMovieClip(frame1, "copy" + _root.frames + i, _root.getNextHighestDepth());
Duplicate the MC that is on the stage.

mc = _root["copy" + _root.frames + i]
Assign the new MC to the variable "mc" to call it like that now.

mc.createEmptyMovieClip("pic", 10);
Create a new MC called "pic" inside the duplicate we just made.

mc.pic._x = -250 mc.pic._y = -187.5
Set the position of the "pic" MC; this MC is where we are going to attach the Bitmap so its position needs to be where you want the picture to start.

mc.pic.attachBitmap(bmd, 1);
Attach the Bitmap with the picture to the "pic" MC with the depth of 1.

} target.removeMovieClip();
Remove the image that was loaded as we won't need it anymore.

_root.frames++ _root.ready = true; }
Increase "frames" by one and let the MCs fall.


More cool tech articles from other blogs.

Place your ad here
Loading...


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

Sponsors





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

Copyright © 2007 NR Concepts Ltd. All rights reserved.