A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: using variable on mc

  1. #1
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476

    using variable on mc

    Code:
    var newProduct:MovieClip = new "product"+j+"_mc";
    What's the proper way to write this line so I can replace the "j" variable with a number and be able to call up the proper mc (i.e. product1_mc)?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    PHP Code:
    var c:Class = getDefinitionByName('product' '_mc');
    var 
    newProduct:MovieClip MovieClip(new c()); 

  3. #3
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476
    Wow, it's times like this that I realize I need to learn actual "programming" to really use as3. There's no way to just figure some of this out without really understanding the language. Thanks so much.

  4. #4
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476
    I'm now getting this.
    Code:
    1118: Implicit coercion of a value with static type Object to a possibly unrelated type Class.

  5. #5
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476
    I just figured out that I needed to add "as Class" to the end of the line.

  6. #6
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Whoops - sorry, forgot that part.

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