Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Tracking movieclip(s) problem

Contributor ,
Sep 29, 2013 Sep 29, 2013

I'm having a problem trying to build a photo slide show. specifically trying to keep track of the movieclips and repositioning them. I've done this before with only two clips, but I cant seem to figure out how to keep track of the multiple (4) positions and the index position of MC in array. I don't have a script built to show, so hopefully an expianation will do?

Set up

Need to keep track of four positions, the first position has a an array item (0) half on the stage half off, position two is centered on the stage and has array item of (1). The third position is half on half off the stage (on the other side) with an array index of (2), and a forth off stage (right) with an index of (3).

* each of these MC's are not being loaded dynamically, the are on the stage, in array contains instances of MC

What I'd like to happen

after a timeout/interval all the mc's would move Right to left, into the neighbors positon, wait and repeat based on the next index of the array, and loop back to the first frame to repeat the gallery again.

I keep getting caught in a maze, of logic a think I can controll one aspect, but then the other dosen't work. Hopefully the explanation is enough for someone to help me see a solution to the maze I'm in.

(Tried yellling Odysseus but I got now secert passage to get to my solution.....Sorry old ZORK refefence I had to make)

              Thanks

TOPICS
ActionScript
852
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 29, 2013 Sep 29, 2013

In what way are frames (the timeline) involved with this? 

If you do this using the timeline there should not be an issue with using code other than the time out aspect you mentioned.

If you do this with code, then it should be as easy as telling each piece to move to the left some number of pixels, and if the position at some point leads to an object exceeding the boundary you move it to the off-stage position.  THis should realize the looping you are looking for with the need for an array to keep track of anything.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 05, 2013 Oct 05, 2013

Im doing it all in code, and I cant get it to work...and I feel kind of frustrated and stupid I can't get it to work. Here is what I have been playing around with. It works when I have 4 items in my array, when I add another it breaks. Id like it to work with any array length (above four).

This is just to get

var thepics = new Array ("0","1","2","3");

var picnum=0

var nextone = setInterval (nexttween, 2000)

function nexttween ()

{

          if(picnum == (thepics.length -1)) {picnum = 0} else {picnum = picnum +1}

          trace ("slotOne " + picnum)

 

          if(picnum == (thepics.length -1)) {picnum = 0} else {picnum = picnum +1}

          trace ("slotTwo " + picnum)

 

          if(picnum == (thepics.length -1)) {picnum = 0} else {picnum = picnum +1}

          trace ("slotThree " + picnum)

 

          if(picnum == (thepics.length -1)) {picnum = 0} else {picnum = picnum +1}

          trace ("slotFour " + picnum)

          if(picnum == (thepics.length -1)) {picnum = 0} else {picnum = picnum +1}

          trace("-----------------------------")

}

can anybody help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 19, 2013 Oct 19, 2013
LATEST

that doesn't make sense.  all those if-statements are the same. and the trace statements give no helpful info except to confirm that all the if-statements execute

but based on your first message i think you might want something like:

// all should have reg point along the left edge

var imageA:Array=[image1,image2,image3,image4];

var index:Number=1;

var prevIndex:Number;

var nextIndex:Number;

clearInterval(slideI);

slideI=clearInterval(slideF,3000);

function slideF():Void{

prevIndex=(index+indexA.length-1)%indexA.length;

nextIndex=(index+1)%indexA.length;

imageA[prevIndex].x=-imageA[prevIndex].width/2

imageA[index].x=(Stage.width-imageA[index].width)/2;

imageA[nextIndex].x=Stage.width-imageA[nextIndex].width/2

index=nextIndex;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines