Jump to content
Search Community

Dynamic image scrolling

mhmda test
Moderator Tag

Recommended Posts

Hi,

 

I'm loading the images dynimaclly and create an array of movieclip after that I want to tween the array of the images one by one, but something weared happened:-> the first mc loops and loops...

 

here is my code:

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
var j,ptr:int;
var imageLoader:Loader;
var news:XML;
var newslist:XMLList;
var xmlLoader:URLLoader = new URLLoader();
var my_news:Array = []; 

xmlLoader.load(new URLRequest("adn.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void
{
news=XML(event.target.data);
newslist =news.news.image.attributes();
for (var i:int = 0; i < newslist.length(); i++)
{
 imageLoader = new Loader();
 imageLoader.load(new URLRequest(newslist[i]));
 imageLoader.x = 0;
 imageLoader.y = 0;
 var mc:MovieClip = new MovieClip();
 mc.addChild(imageLoader);
 my_news[i]=mc;
}
if(i>0) shownews();
}
function shownews()
{
stage.addChild(my_news[0]);
my_news[0].x=-600;
TweenMax.to(my_news[0], 1, {x:0});
}

 

The my_news[0] loops and never stops :?:

Link to comment
Share on other sites

I suggest you add a trace() right before the tween to see if you're calling that method multiple times (I bet you are). Is your code in the root timeline? If so, does that timeline have more than one frame and is it looping (no stop() call)? That'd explain the behavior. I'm pretty sure it has nothing to do with TweenMax.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...