A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: assigning Z kills movieclip

  1. #1
    Senior Member
    Join Date
    Dec 2005
    Posts
    426

    assigning Z kills movieclip

    When i assign z position a value to a movieclip through its class constructor the movieclip does not display anymore. If i assign it later like in the tween it stops moving.

    here is the code im using

    Code:
    package 
    {
    	import flash.display.MovieClip;
    	import flash.events.*;
    
    	import com.gskinner.motion.*;
    	public class BackgroundCircle extends MovieClip
    	{
    		public var radius:Number;
    		private var moveTween:GTween;
    		public function BackgroundCircle(r:Number, newX:Number, newY:Number)
    		{
    			radius=r;
    			height=0;
    			width=0;
    			x=newX;
    			y=newY;
    			//Hides the movieclip 
                            z=Math.random()*1;
    			moveTween = new GTween(this, 1, {height:r, width:r});
    			moveTween.addEventListener(Event.COMPLETE, move);
    		}
    		public function move(e:Event)
    		{
    			var newX:Number=radius+Math.random()*(stage.stageWidth-radius*2);
    			var newY:Number=radius+Math.random()*(stage.stageHeight-radius*2);
    			var newZ:Number=-500+Math.random()*3000;
                            //Stops moving the movieclip at all.
    			moveTween = new GTween(this, 1, {x:newX, y:newY, z:newZ});
    			moveTween.addEventListener(Event.COMPLETE, move);
    		}
    	}
    }

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    MovieClips don't have a z property. Consult the livedocs.

  3. #3
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    This is flash 10 btw,

    and it works on my computers sometimes but no one elses.

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    d'oh. I knew I should have triple checked before asserting something like that.

  5. #5
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    I solved the error with moving about the z axis. But I cannot set the z position of a movieclip in its constructor.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center