News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

actionscript help

Farted by SpongeClock SquarePants, December 11, 2008, 11:35:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SpongeClock SquarePants

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 :'(

PineappleClock

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();

SpongeClock SquarePants

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.

PineappleClock

cool - let me know if there's any AS3 tutorials you'd like to see, I did one on particle systems but I'd like to do more in the future.

SpongeClock SquarePants

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.

SpongeClock SquarePants

#5
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