Go Back   kirupaForum > Flash > ActionScript 1.0/2.0

Reply
 
Thread Tools Display Modes
Old 11-29-2009, 06:40 PM   #1
rmcnaugh2
hee...hee..hee
 
rmcnaugh2's Avatar
Location newy ork city

Posts 12
Using an array to make movieclips tween to a radius

Hey everyone and thanks for any help in advance. I'm using an array to store movie clips and use them to tween position around a central movieclip when pressed and then tween back to the center when pressed again. I would like the _x and _y positions to tween around the central movieclip in a clock-like postion.

As of now I'm using raduis and degrees to tr try to get this effect, but i've had many problems. Right now the movieclips just fan out in a straight line. Does anyone have any idea how to fix this. Here is the code:

Code:
///////  MX Transitions
import mx.transitions.*;
import mx.transitions.easing.*;
import mx.transitions.tween.*;
import caurina.transitions.*;
import flash.filters.BlurFilter;
import flash.filters.GlowFilter;
import flash.display.*;

//////// DROPSHADOW FILTER
//apply a filter to MC
var myFilter = new flash.filters.DropShadowFilter();
myFilter.angle = 35;
myFilter.distance = 2.5;
myFilter.color = 0x000000;

//menuOne
menuOne._x = Stage.width/2-menuOne.zero._width;
menuOne._x = Stage.height/2-menuOne.zero._height;
menuOne.onResize = function(){
menuOne.tween(["_x","_y"],[Stage.width/2-menuOne.zero._width,Stage.height/2-menuOne.zero._height],.3, "easeoutExpo",0);
};
Stage.addListener (menuOne);
menuOne.onResize();


////////MAIN NAV ROLLOVER CONTROLS
var groupinfo:Array = [menuOne.one,menuOne.two,menuOne.three,menuOne.four,menuOne.five,menuOne.six];
trace(groupinfo.length);
// assign functions to each event for each button in the group
function init(r:Number, x:Number, y:Number):Void {
      for (var c in groupinfo) { 
      groupinfo[c].push;
      groupinfo[c].onRollOver = doRollOver;
      groupinfo[c].onRollOut = doRollOut;
      groupinfo[c].onRelease = doClick;
	  var radius = 30;
	  var degree = 0;
	  var orbit = (degree/180)*Math.PI
	  var radian;
	  //
	 groupinfo[c].tween(["_x","_y"],[(Math.cos(orbit) * radius + menuOne.zero._x)*c, (Math.sin(orbit) * radius + menuOne.zero._y)*c],.7,"easeoutExpo",0);//controls X andY space between array elements
	  trace("groupinfo._x = "+groupinfo[c]._x);
	  trace("groupinfo._y = "+groupinfo[c]._y);
	  groupinfo[c].filters = [myFilter];//dropShadow
   }

}
function init02(r:Number, x:Number, y:Number):Void {
      for (var d in groupinfo) { 
	  groupinfo[d].push;
	  groupinfo[d].tween(["_x","_y"],[0,0],.7,"easeoutExpo",0);//controls Y space between array elements
	  trace("groupinfo._x = "+groupinfo[c]._x);
	  trace("groupinfo._y = "+groupinfo[c]._y);
   }

}
function checkInstance(input:MovieClip, arr:Array) {
   var l:Number = groupinfo.length;
   for(var i:Number=0;i<l;i++) {
        var selectedItem:MovieClip = groupinfo[i];
        if (input == selectedItem) {
            trace("selectedItem " + selectedItem._name+ " is in the arr");
       }
   }
}
// create a variable to track the currently selected button
var activebtn:MovieClip;

//define handler function for rollovers
function colorGo() {
this.tween("_alpha",50,.5,"easeOutSine");
}
function colorBack() {
this.tween("_alpha",100,.5,"easeOutSine");
}
function doRollOver():Void {
    if (this != activebtn) {
    this.onEnterFrame = colorGo;
	trace(checkInstance(this, groupinfo[i]));
   }
}
function doRollOut():Void {
	if(this != activebtn) {
    this.onEnterFrame = colorBack;
	//trace(checkInstance(this, groupinfo[i]));
   } 
}	
// doClick: 1) save a reference to previously active button, 2) update activebtn, 
// 3) turn off previously active, 4) turn on current active
function doClick() {
	var prevbtn:MovieClip = activebtn;
    activebtn = this// update pointer to current selection   
    prevbtn.onRollOut();//update other movieClips
	activebtn.enabled = false;//disabled pressed button
	prevbtn.enabled = true;//enabled other buttons
	clearInterval(myIntervalSlide03);//clear interval
}

////////////ZERO
press01 = true;
menuOne.zero.onRollOver = function(){
this.tween("_alpha",50,.5,"easeOutSine");
}
menuOne.zero.onRollOut = function(){
this.tween("_alpha",100,.5,"easeOutSine");
}
menuOne.zero.onRelease = function(){
	if (press01 == true) {
	init();
	press01 = false;
	trace("buttons Out");
	} else {
	init02();
	press01 = true;
	trace("buttons In");
	}
}

any help would be appreciated,
thnx,

rmcnaugh...
Attached Files
File Type: as treeMenu.as (4.6 KB, 0 views)
rmcnaugh2 is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off

Forum Jump


All times are GMT -4. The time now is 12:34 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com