A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: AS3 refer to other movieclips from a movieclip

  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    8

    Question AS3 refer to other movieclips from a movieclip

    I have two movieclips on the stage... man and enemies, inside man there is a movieclip called sword, inside enemies there is a movieclip called enemy then inside that a movieclip called float.

    stage -> man -> sword
    stage -> enemies -> enemy -> float

    Is there anyway I can refer to sword from within enemy?
    the code would be for a hitTest like:

    Code:
    if (float.hitTestObject("way to refer to sword"))==true{
             nextFrame();
    }

  2. #2
    Senior Member Shnitzel's Avatar
    Join Date
    May 2007
    Location
    IL
    Posts
    130
    have you tried:
    _root.man.sword
    ?

  3. #3
    Junior Member
    Join Date
    Dec 2008
    Posts
    8
    Thats for AS2 fool!

  4. #4
    Senior Member Shnitzel's Avatar
    Join Date
    May 2007
    Location
    IL
    Posts
    130
    Sorry, sorry, wasn't thinking clearly >_<''
    I don't know the first thing in AS3
    Last edited by Shnitzel; 03-10-2009 at 04:39 PM.

  5. #5
    Junior Member
    Join Date
    Dec 2008
    Posts
    8
    Any one else got any ideas?

    In AS3 this time please

  6. #6
    Senior Member Shnitzel's Avatar
    Join Date
    May 2007
    Location
    IL
    Posts
    130
    Alright, alright, I want to correct my mistake ><'
    I checked google and it was surprisingly hard to find this.
    AS3 replaced "_root" with "MovieClip(root)".

    So the code should go:
    MovieClip(root).man.sword
    (Assuming both are in the same root)
    I also saw something about stage, so if root doesn't work try stage :S

    Otherwise, there's a category here for AS3

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