+ Reply to Thread
Results 1 to 1 of 1

transition Iris

This is a discussion on transition Iris within the Tutorials forums, part of the Flash English category; I created a simple image gallery slideshow that demonstrates how to use the Iris class of Flash transitions. The Iris ...

  1. #1
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    transition Iris

    I created a simple image gallery slideshow that demonstrates how to use the Iris class of Flash transitions.


    The Iris class reveals the movie clip object by using an animated mask of a square shape or a circle shape that zooms in or out.

    This effect requires the following parameters:

    startPoint: An integer indicating a starting position; the range is 1 to 9:

    Top Left:1;

    Top Center:2,

    Top Right:3;

    Left Center:4;

    Center:5;

    Right Center:6;

    Bottom Left:7;

    Bottom Center:8,

    Bottom Right:9.

    shape: A mask shape of either fl.transitions.Iris.SQUARE (a square) or fl.transitions.Iris.CIRCLE (a circle).


    I imported 12 images in the library of Flash, I assigned to each of them a class to "attack" from the library to the Stage with Actionscript.

    Then, using a timer and classes TransitionManager and Iris, I created the image gallery.









    The code I used:


    Code:
    package
    {
    	import flash.display.*;
    	import flash.text.*;
    	import flash.events.*;
    	import flash.utils.*;
    	import fl.transitions.*;
    	import fl.transitions.easing.*
    	
    	public class Main extends MovieClip
    	{
    		private var image_classes:Array;
    		
    		private var timer:Timer;
    		
    		private var holder_mc:MovieClip;
    		
    		private const SPEED:int=3;
    		
    		private var boo:Boolean=true;
    		
    		private var id:int=0;
    		
    		public function Main()
    		{
    			addEventListener(Event.ADDED_TO_STAGE,init);
    		}
    		
    		private function init(evt:Event):void
    		{
    			removeEventListener(Event.ADDED_TO_STAGE,init);
    			
    			image_classes=new Array("Caustic","Condensed","Dewdrop","Division","Frozen","Fusion",
    									"FusionBlue","GoingUp","Jacks","Magma","Marine","Photosynthesis");
    			
    			createHolder();
    			displayImage();
    		}
    		
    		private function createHolder():void
    		{
    			holder_mc=new MovieClip();
    			addChild(holder_mc);
    		}
    		
    		private function displayImage():void
    		{
    			if(holder_mc.numChildren>0)
    			{
    				var bitmap:Bitmap=holder_mc.getChildAt(0) as Bitmap;
    				holder_mc.removeChild(bitmap);
    			}
    			var image_class:Class=Class(getDefinitionByName(image_classes[id]));
    			var imgData:BitmapData=new image_class(0,0);
    			var img:Bitmap=new Bitmap(imgData);
    			img.x=stage.stageWidth/2-img.width/2;
    			img.y=stage.stageHeight/2-img.height/2;
    			holder_mc.addChild(img);
    			
    			TransitionManager.start(holder_mc,{type:Iris,direction:Transition.IN,
    			duration:1,easing:Strong.easeOut,startPoint:5,shape:Iris.CIRCLE}); 
    			startDisplayTimer();
    		}
    		
    		private function hideImage(evt:TimerEvent):void
    		{
    			TransitionManager.start(holder_mc,{type:Iris,direction:Transition.OUT,
    			duration:1,easing:Strong.easeOut,startPoint:5,shape:Iris.CIRCLE});
    			startHideTimer();
    		}
    		
    		private function startDisplayTimer():void
    		{
    			if(timer!=null)
    				timer.reset();
    			timer=new Timer(SPEED*1000,1);
    			timer.addEventListener(TimerEvent.TIMER,hideImage);
    			timer.start();
    		}
    		
    		private function startHideTimer():void
    		{
    			if(timer!=null)
    				timer.reset();
    			timer=new Timer(1000,1);
    			timer.addEventListener(TimerEvent.TIMER,callDisplayImage);
    			timer.start();
    		}
    		
    		private function callDisplayImage(evt:TimerEvent):void
    		{
    			id++;
    			if(id>image_classes.length-1)
    				id=0;
    			displayImage();
    		}
    	}
    }
    Attached Files

+ Reply to Thread

Similar Threads

  1. transition Rotate
    By Flep in forum Tutorials
    Replies: 1
    Last Post: 19-01-12, 11:38
  2. transizione Iris
    By Flep in forum Articoli e tutorials
    Replies: 1
    Last Post: 08-07-10, 15:09
  3. transition Squeeze
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 26-09-09, 04:46
  4. transition Photo
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 19-09-09, 04:46
  5. transition Fly
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 12-09-09, 10:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts