• Home
  • Free Tutorials
  • Free Video Tutorials
Your Ad Here
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 Star Style

Category : Flash Views : 77040
Version : 8 Rating : 
2.9/5 (135 votes)
  • Currently 2.95/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: xml-image-gallery-with-star-style.zip
Result: See the result


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

listener.onLoadInit = function(target) {
This event has only one parameter: target, that is the MC we used to load the image.

var bmd:BitmapData = new BitmapData(200,150);
Create a new BitmapData with the size "200x150", if your frame MC has a different size you need to change these values.

var xscale = 200/target._width var yscale = 150/target._height
The image we are loading is probably bigger than the size we want so we need to scale it, but we need to know the scale value.
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 is used to scale the image to the size we want.

MT.scale(xscale, yscale)
Set the MT object to scale using the values we got above.

bmd.draw(target, MT);
Now we call the function draw() of the BitmapData to draw the image to the bitmap in the size we want.
This function has these parameters:
draw(object to draw, Matrix object)
The matrix parameter is optional, but we used it because we need to scale the image.

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

mc = _root.framesMC.attachMovie("frame", "frame" + _root.frames, _root. framesMC.getNextHighestDepth());
Here we attach the "frame" MC from the gallery to the "framesMC", the attachMovie returns the MC instance so we use the variable "mc" to call this instance.

mc.createEmptyMovieClip("pic", 10);
Create a MC inside the MC we just created; here we will attach the image we loaded.

mc.pic._x = -100 mc.pic._y = -75
Set the position of the image inside the "frame" MC; these values also depend on how you draw your MC.

mc.pic.attachBitmap(bmd, 1);
Attach the bitmap with the image to the "pic" MC.

mc.x = Math.random() * 2000 – 1000 mc.y = Math.random() * 1600 – 800
These are two variable are the position of the MC, but as we are dealing with 3D the actual position (_y and _x) will depend on the distance of the MC from the user and the coordinates will be calculated later.

mc.z = _root.frames * 1000
This is the variable that represents the distance between the MC and the user, the bigger this variable is farther the MC will be and vise-versa.


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







Your Ad Here

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

Copyright © 2007 NR Concepts Ltd. All rights reserved.