Jump to content


Photo

AS2 to AS3 converson help


  • Please log in to reply
No replies to this topic

#1 spirittoons

spirittoons

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 13 June 2009 - 02:33 AM

ok i need to be able to create multiple similar sprites/movieclips inside of a for loop
each new sprite/movieclip has to be names according to the number of "i" in the loop
i know how to do it in AS2 but i have searched for methods for doing a similar thing in AS3 to no avail.

here is the code to successfully achieve this in AS2:
[codebox]for ( var i = 0; i < 5; i ++ ) {

// Create currentThumb MC
var currentThumb = Scroller.allThumbs.createEmptyMovieClip ( "Thumb" + i, i );
currentThumb._x += 10 + ( i * spacing );

// Setting Data for all the thumbs etc[/codebox]

i know that to create movieclips in AS3 you need var MC:MovieClip = new MovieClip and all that
but i need the dynamic names of movieclips

if its possible to have a Sprite container that loads in preset movieclips such as:
[codebox]//creating many sprites
var sprite1:Sprite = new Sprite()
var sprite2:Sprite = new Sprite()
var sprite3:Sprite = new Sprite()
var sprite4:Sprite = new Sprite()

for ( var i = 0; i < 4; i ++ ) {

// Create currentThumb MC
var currentThumb = sprite + i;
currentThumb._x += 10 + ( i * spacing );

// Setting Data for all the thumbs etc[/codebox]

is there some way of converting this into AS3?
thanks in advance for any assistance :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users