A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: invoke function in as3

  1. #1
    Member
    Join Date
    Jan 2003
    Location
    portugal
    Posts
    40

    invoke function in as3

    Hi,

    Simple with as2... but i can't with as3..
    How can i invoke a function in a parent mc... from one of its childs mc??

    I've a child MC with 2 frames... in the second one i want to invoke a funtion mostrarHorario(), that is located in the parent MC of this...

    Please... help me
    thanks.
    caugusto

  2. #2
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269
    I think it's something like 'this.parent.functionName()', but I could be wrong.

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    We should put this on a t-shirt or something.
    Code:
    MovieClip(parent).functionName();
    The issue is that the parent property is typed as DisplayObjectContainer which doesn't have the function you are trying to find, and is not dynamic either. Casting to MovieClip lets you try to call arbitrary properties because MovieClip is dynamic. If your parent is NOT a MovieClip, you will have to cast to whatever it actually is.

  4. #4
    Member
    Join Date
    Jan 2003
    Location
    portugal
    Posts
    40
    thanks,
    caugusto

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