A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: as2 control frames inside a symbol

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    26

    Angry as2 control frames inside a symbol

    hey guys, im trying to make my own crappy pokemon game with the 151 first pokemons

    so far if got a button that encounters a random number 1-151 and displays it
    but now i want to add some pics to those numbers

    so i made a symbol, not sure if i need a movieclip or a graphic, then i made 151 frames in that and started adding pics to each frame

    now the question is, how do i control those frames inside the symbol, to change to the right pic

    noobie example of what i need:
    on(press)
    {
    randompokemon = random(152)

    if (randompokemon == 4)
    {
    _root?.movieclip1? gotoAndStop(4)
    }
    }
    so when the random number generator picks, lets say 4, the movieclip1 symbol with 151 frames/pics will change to frame/pic 4

    anyone can translate my crappy understanding of coding, to something that works
    thx in advance

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    try something like this.

    Code:
    on (press) {
    	randompokemon = random(152);
    	_root.movieclip1.gotoAndStop(randompokemon);
    	trace(randompokemon);
    }
    my hobby

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    26
    ha i was so close, just the . i forgot
    didnt knew how to connect _root.movieclip1 to gotoAndStop
    also i would just copy paste if (randompokemon == 0) if = 1..if2.3.4.5.6.150 lol good you mentioned (randompokemon) instead of (4)
    Last edited by Kascas; 09-03-2012 at 01:22 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center