dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: [RESOLVED] Class files...can one make another?

  1. #21
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    I don't have my code in front of me but if I remember correctly it consists of applying a display object to each shapes .userData property at creation.
    Then during your timestep, run something like

    for (var b:b2Body = myWorld.GetBodyList(); b; b = b.GetNext())
    {
    myDisplayObject = b.userData;
    myDisplayObject.x = b.x;
    }

    I'm probably wrong about the property names but that's the general idea.

  2. #22
    Senior Member
    Join Date
    May 2009
    Posts
    280
    This is...interesting and really simplified...

    hey, can you make a movieclip part of a b2body's userdata? or does it HAVE to be a class file becasue thats honestly what this whole forum is about...

  3. #23
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    I don't see the point of making anything that doesn't extend DisplayObject part of user data since the whole point is visualization. If you class extended movieclip then yeah it would work.

    The whole idea of writing a class at runtime doesn't really make good OOP sense unless there is a completely uncharted reason for doing so.

  4. #24
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    <double post/>

  5. #25
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Assigning a movieclip as the userdata is what we've been trying to tell you to do. It may be technically possible to assign a class, but it is not what you want to do. You should bone up on the difference between a class and an instance, because it will bite you in the add until you understand it.

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