Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Tweener caurina by Zeh Fernando - example 2

This is a discussion on Tweener caurina by Zeh Fernando - example 2 within the Tutorials forums, part of the English Forums category; After seeing how to use Tweener Caurina of Zeh Fernando in the first tutorial by FlepStudio, here is the second ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Tutorials

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  7 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 23-06-08, 08:55
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,354
Blog Entries: 1
Rep Power: 6
Flep is on a distinguished road
Tweener caurina by Zeh Fernando - example 2

After seeing how to use Tweener Caurina of Zeh Fernando in the first tutorial by FlepStudio, here is the second example.

This time I simulated the creation of a website in Flash CS3, with colored background that changes according to the section, menus and content all simulated using the tweener caurina.


I would like to say that for people who need a tweener, in my opinion Caurina is the best one.

Be that as fact and as simplicity and immediacy in its use.


Example:









Main.as :
Code:
package
{
	import flash.display.*;
	import flash.events.*;
	import flash.utils.getDefinitionByName;
	import caurina.transitions.Tweener;
	
	public class Main extends MovieClip
	{
		private var items_array:Array;
		private var background_colors:Array;
		
		private var container_mc:MovieClip;
		private var underline_mc:MovieClip;
		
		private const ROWS:int=10;
		
		public function Main()
		{
			addEventListener(Event.ADDED_TO_STAGE,init);
		}
		
		private function init(evt:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE,init);
			
			stage.frameRate=31;
			
			items_array=new Array(menu_mc.item_0_mc,menu_mc.item_1_mc,menu_mc.item_2_mc,menu_mc.item_3_mc,menu_mc.item_4_mc);
			background_colors=new Array(0x006699,0xCC0066,0xFF3300,0x009900,0x333333);
			
			changeItemColor(0);
			displayContent("Square");
			
			addMenuListeners();
		}
		
		private function addMenuListeners():void
		{
			for(var i:int=0;i < items_array.length;i++)
			{
				items_array[i].id=i;
				items_array[i].mouseChildren=false;
				items_array[i].buttonMode=true;
				items_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
				items_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
				items_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
			}
		}
		
		private function setOver(evt:MouseEvent):void
		{
			underline_mc=new MovieClip();
			underline_mc.graphics.beginFill(0xFFFFFF,1);
			underline_mc.graphics.drawRect(0,0,1,1);
			underline_mc.x=evt.target.x;
			underline_mc.y=evt.target.y+evt.target.height+5;
			menu_mc.addChild(underline_mc);
			
			Tweener.addTween(underline_mc,{width:evt.target.width+5,time:0.3,transition:"easeOutQuad"});
		}
		
		private function setOut(evt:MouseEvent):void
		{
			if(underline_mc!=null)
			{
				menu_mc.removeChild(underline_mc);
				underline_mc=null;
			}
		}
		
		private function setDown(evt:MouseEvent):void
		{
			Tweener.addTween(bg_mc,{_color:background_colors[evt.target.id],time:1.2,transition:"easeOutQuad"});
			
			menu_mc.removeChild(underline_mc);
			underline_mc=null;
			changeItemColor(evt.target.id);
			
			switch(evt.target.id)
			{
				case 0:
					displayContent("Square");
				break;
				
				case 1:
					displayContent("Circle");
				break;
				
				case 2:
					displayContent("Star");
				break;
				
				case 3:
					displayContent("Oval");
				break;
				
				case 4:
					displayContent("Line");
				break;
			}
		}
		
		private function changeItemColor(n:int):void
		{
			for(var i:int=0;i < items_array.length;i++)
			{
				if(i==n)
				{
					items_array[i].mouseEnabled=false;
					Tweener.addTween(items_array[i],{_color:0x000000,time:1.5,transition:"easeOutQuad"});
				}
				else
				{
					items_array[i].mouseEnabled=true;
					Tweener.addTween(items_array[i],{_color:0xFFFFFF,time:1.5,transition:"easeOutQuad"});
				}
			}
		}
		
		private function displayContent(s:String):void
		{
			var className:Class=getDefinitionByName(s)as Class;
			
			if(container_mc!=null)
			{
				removeChild(container_mc);
				container_mc=null;
			}
			container_mc=new MovieClip();
			for(var i:int=0;i < 50;i++)
			{
				var clip:MovieClip=new className();
				clip.scaleX=clip.scaleY=0;
				clip.x=66+((i%ROWS)*30);
				clip.y=66+(Math.floor(i/ROWS)*30);
				Tweener.addTween(clip,{scaleX:2,scaleY:2,delay:0.05*i,time:0.2,transition:"easeOutQuad"});
				container_mc.addChild(clip);
			}
			container_mc.x=(stage.stageWidth-container_mc.width)/2;
			container_mc.y=(stage.stageHeight-container_mc.height)/2;
			addChild(container_mc);
		}
	}
}
Source files:
Attached Files
File Type: zip Caurina_2.zip (88.0 KB, 146 views)

__________________

 


I recommend: Essential Actionscript 3.0

- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
- I do not reply technicians pvt messages. Open a thread !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 24-06-08, 10:24
Junior Member
 
Join Date: Jul 2007
Posts: 9
Rep Power: 0
derrida is on a distinguished road
Re: Tweener caurina by Zeh Fernando - example 2

Hi

first of all: thank you for this amaizing site. i learn here so much.

when i wrote this i gor the error message:

## [Tweener] Error: The property '_color' doesn't seem to be a normal object property of [object MovieClip] or a registered special property.


what is that? i do have Tweener.


best regards

ron
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Tweener caurina di Zeh Fernando - tutorial 1 Flep Articoli e tutorials 26 10-10-08 12:56
Tweener caurina di Zeh Fernando - tutorial 2 Flep Articoli e tutorials 5 29-08-08 12:37
Ripetere effetto tweener... come? jadevil Flash CS3 generale 2 01-04-08 21:00
Caurina Tweener by Zeh Fernando - tutorial 1 Flep Tutorials 8 27-03-08 12:11
tweener gwulfwud Actionscript 3.0 newbies 3 17-12-07 04:06


All times are GMT. The time now is 07:02.


Powered by vBulletin versione 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406