Flash movememt
- Started
- Last post
- 11 Responses
- rasko4
I have a movieclip with say 3 images positioned vertically, I need to have 2 buttons (forward and backward) that will slide the movieclip to the next/prev position, obviously when you get to the last image but you continue to hit the forward button (down) then you would go back to the first image.. how would I do this, I'm having trouble finding a tute.
If anyone has an fla of something similar that would be brilliant!
thanks :)
- rasko40
basically, imagine it to be a fruit machine reel and a nudge up and down button, if that helps to make sense ;)
- ganon0
button MCs (instance names button01, button02), put this in a frame in the _root...:
this.button01.onPress {
this._parent.imgs._y + 25;
}this.button02.onPress {
this._parent.imgs._y - 25;
}with your image MC instance name "imgs"....
- rasko40
thanks Ganon, nearly but thats not quite what I wanted, I need some code that actually slides the movieclip into place ideally with a little bounce back at the end but thats not essential.
Also, any idea how I would make it appear to loop if the person continued pressing forward?
- ozhanlion0
rasko do we see all those vertical mcs at the same time ?
I mean do they get anyhow anytime out of canvas ? because if you have a center of focus (mc) you can save its coordinates in a variable and you can attach those mcs from the library according to that coordinates m8.search some inertia for the bounce effects. like getting the distance and dividing it to the distance minus something.
hth
- rasko40
well I'm not a flash dude so I need ot keep it simple but yeah, basically the main content is a movie clip and i have 2 buttons that I want to make the content slide to the next item, ideally I want it to loop aroundif the poerson keeps clicking in the same direction.
does that make sense?
- unfittoprint0
What you want to do is make those imagesmovieclips inside another MC, that will be targeted with the slide movement ocurs.
inside the MC you should have a loop that will checkif the image[s] have passed the _x [or _y] limit. If so, it will delete them and attach them to the end again.
//inside slideMC
numberImg = 3;
slack = 50;
limit=0//in the library name image1,
// image2, image3, etc...checkImg = function(objCount){
lastObj = (lastObj ==undefined) ? this["image"+objCount] : lastObj;
if (_parent._x+this["image"+i]._x+t... ) {
this["image"+i]._x = lastBG._x+lastBG._width;
lastBG = this["image"+i];
i = (i{objCount) ? ++i : 1;
}
}startChk = function(objCount){
i=1;
clearInterval(checkLoop):
checkLoop=setInterval(this,"chec... ", 30, objCount);
}//start putting images
//from the library
for(i=1; i{=numberImg; i++){
this.attachmovie("image"+i; "image"+i; i);
this["image"+i]._x = this["image"+(i-1)]._x + this["image"+(i-1)]._width + slack
};startChk(numberImg);
- rasko40
thanks unfit.. k I may be out of my depth here.. its giving me 3 errors on your code and I cant really fix it..
err.. how do I just slide the thing up and down and I'll just put it a dead end symbol or something? :)
- rasko40
so i can just have the up and down buttons telling the MC to move up or down by a fixed amount of say 120pixels and slide smoothly into place, ideally with a little 'bounce'?
thanks again.
- rasko40
anybody?
must be an easy one cos everything I find is too complex for what I need?
- unfittoprint0
Note: { and } relate to less than and bigger than. replace them.
images = 6;
i=0;changey=function(targety){
myMC._y += ((targety - myMc._y)/4)*0.8;
}slide = function(targety){
clearinterval(slideLoop)
slideLoop
= setinterval(this,"changey", 30, targety)
}//button actions
up.onPress=function(){
(i{6)? ++i : false
(i{6)?slide(i*120) : false;
}down.onPress=function(){
(i}1)? --i : false
(i}1)?slide(i*120):false;
}
- rasko40
thanks unfittoprint, I've emailed something to your hotmail...
:)