A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: how to create a symbol in code

Hybrid View

  1. #1
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54

    how to create a symbol in code

    how do I create a symbol in code from the library and name it in code

    Current File:
    http://www.filedropper.com/untitled1_13
    Last edited by ym54; 01-29-2010 at 05:41 PM.

  2. #2
    Senior Member
    Join Date
    Jul 2009
    Posts
    113
    I don't think you can create new "library symbols" dynamically using ActionScript.

    What you can do is create copies of "symbols" that are already in the library.

  3. #3
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    that's what I meant

  4. #4
    Senior Member
    Join Date
    Jul 2009
    Posts
    113
    In AS3 if you've created a symbol and given it a class name "TestSymbol".

    You can create a copy of the symbol like so...

    Code:
    var test:TestSymbol = new TestSymbol();
    addChild(test);

  5. #5
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    In AS2, you would use the attachMovie() method.

  6. #6
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    ok how can you make everything from the same class behave the same way

  7. #7
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    ok I put the code in

    but the bullet is not appearing
    how do I define its appearing spot

    also how do I make its angle, and direction the same as "shooter"

    and make it go that way
    current code:
    PHP Code:
    setInterval(shoot,10);

    function 
    shoot(){
        
    shooter.direction=Math.atan2((shooter.y-mouseY),(shooter.x-mouseX));
        
    shooter.rotation=(shooter.direction*180/Math.PI-90);
        
    shooter.speed=20
        
    var test:bullet = new bullet();
        
    addChild(test);


  8. #8
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Are you using AS2 or AS3?

  9. #9
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    as3

  10. #10
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    have you setup a linkage with the export to Actionscript checked, and the correct class name?

  11. #11
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    what now?

  12. #12
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    bump

  13. #13
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    bump

  14. #14
    prgrmr 4 hours user 4 years
    Join Date
    Dec 2009
    Location
    behind you
    Posts
    54
    bump

Tags for this Thread

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