Clock Crew

Community => Flash & Flash Accessories => Topic farted by: SpongeClock SquarePants on December 11, 2008, 11:35:00 AM

Title: actionscript help
Post by: SpongeClock SquarePants on December 11, 2008, 11:35:00 AM
ok
i want to use a variable path

first i make an array

var menuArray:Array = new Array("trip", "total", "time", "mxs", "avs");
theres also a variable, called currentvalue, that gets a certain array value loaded into it. currentvalue = menuArray[2]changing the value of currentvalue works fine.

What i want is not this:

this.movieclip.trip.play();
but something like

this.movieclip.[currentvalue].play();
problem is i dont recall how :'(
Title: actionscript help
Post by: PineappleClock on December 11, 2008, 02:40:38 PM
in AS2 you were close, it's:

this.movieclip[currentvalue].play();


that's if you have a movieclip named "movieclip" on your root (which is bad form). If the movieclip's name is currentvalue and it's just on the root, its like this:

this[currentvalue].play();


and in AS3 its:

this.getChildByName(currentvalue).play();
Title: actionscript help
Post by: SpongeClock SquarePants on December 11, 2008, 03:00:15 PM
ah thx alot, pineaple, indeed i knew i was close!
Im allready taking my first steps in as 3.0 but ive with a rather short deadline on this project, hence the 2.0.
Title: actionscript help
Post by: PineappleClock on December 11, 2008, 03:30:32 PM
cool - let me know if there's any AS3 tutorials you'd like to see, I did one on particle systems (http://www.clockcrew.cc/tutorials/as3particles/) but I'd like to do more in the future.
Title: actionscript help
Post by: SpongeClock SquarePants on December 16, 2008, 06:26:33 AM
New problem,

Ive made an movieclip(compleet)draggable and shifted along the Y axis.


_root.compleet._y = 80;
_root.compleet.onPress = function() {
 this.startDrag();
}


What i want is for the user to be able to drag the "compleet" movieclip into the original area. Where the movieclip will snap back into its old place and becomes undraggable again.

Problem is i dont know how to make it snap.
Title: actionscript help
Post by: SpongeClock SquarePants on December 16, 2008, 07:21:47 AM
ok wait, will this also work with a hittest?

EDIT: yes, a hittest did the trick.
now to find a way to make the "compleet" movieclip undraggable and fully functional(it contains buttons) again.

EDIT: alos fixed.


turns out this  wasnt hard at all