Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Results 1 to 1 of 1

Thread: Understanding MovieClip z property of Flash CS4

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

    Understanding MovieClip z property of Flash CS4

    amazing Flash templates

    What 's the first thing that jumps to eyes when you are reading the MovieClip class reference of Flash CS4?


    Of course the z property !


    With Flash CS3 we saw how to simulate it:



    The big news of Flash CS4 is that we will not go into hard mathematical coding and that certainly hinder us from continuing to create animations that simulate third dimension.

    The famous z axis has been implemented in Actionscript version 3.0 of Flash CS4 and it's simple to be used.


    This is the first sample tutorial that shows how to use the property z with Flash CS4.







    Code:
    var clips:int=500;
    var distance:int=20;
    createClips();
    function createClips():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2-200;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }





    Code:
    var clips:int=500;
    var distance:int=20;
    createClips();
    function createClips():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2+100;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }





    Code:
    var clips:int=500;
    var distance:int=20;
    createClips();
    function createClips():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2-200;
    		clip.y=stage.stageHeight/2+100;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }





    Code:
    var clips:int=500;
    var distance:int=20;
    createClips();
    function createClips():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2+100;
    		clip.y=stage.stageHeight/2+100;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }





    Code:
    var clips:int=500;
    var distance:int=20;
    
    createClips();
    createClips2();
    createClips3();
    createClips4();
    
    function createClips():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2-200;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }
    
    function createClips2():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2+100;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }
    
    function createClips3():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2-200;
    		clip.y=stage.stageHeight/2+100;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }
    
    function createClips4():void
    {
    	for(var i:int=0;i < clips;i++)
    	{
    		var clip:Clip=new Clip();
    		
    		clip.x=stage.stageWidth/2+100;
    		clip.y=stage.stageHeight/2+100;
    		clip.z=10000-distance*i;
    		
    		addChild(clip);
    	}
    }

    The first thing you notice is the behavior of z property.

    The more the value is high and more the MovieClip is far from our eyes.

    This means that for example a MovieClip with a value of its z property equal to 1000 will be farther than a MovieClip with value -1000.


    Also, if you try to set the values of x and y equal to stage.stageWidth / 2 and stage.stageHeight / 2 (so exactly in the center) you will see that 3D effect vanishes.


    Moreover, the more the value of the variable "distance" is high and the MovieClips will be separated from each others.


    PS: the point of registration of the square MovieClip is a 0,0 .


    Make your experiments!



    Source file:
    Attached Files

+ Reply to Thread

Similar Threads

  1. Aiuto as3 movieclip "set e get Property"
    By Orfen in forum Flash Italiano
    Replies: 0
    Last Post: 20-01-10, 01:55
  2. Z property Flash CS4 sample 2
    By Flep in forum Flash CS4 Tutorials
    Replies: 4
    Last Post: 09-01-10, 13:48
  3. Name property problem
    By xPINKMERCEDESx in forum advanced Actionscript 3.0
    Replies: 1
    Last Post: 19-04-09, 02:35
  4. La proprieta z della classe MovieClip di Flash CS4
    By Flep in forum CS4 Articoli e tutorials
    Replies: 0
    Last Post: 23-11-08, 08:26
  5. Replies: 9
    Last Post: 03-10-07, 21:39

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

Search Engine Optimization by vBSEO