Posted By

Winkyboy on 06/01/09


Tagged

function movieclip child call as3 Parent loaded calling


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

Blacksnipe
visualadvance
Emmi
TrentSkunk
tspitzr
dubogii
Massive


AS3 Calling a parent function from a child movieclip


 / Published in: ActionScript 3
 

URL: http://flexcomps.wordpress.com/2008/09/01/as3-calling-myfunction-on-main-timeline-from-loaded-swf/

I believe there are more elegant ways of doing this, but this does work for referencing a function on the main timeline of a shell/parent movieclip by a loaded, child movieclip. This would be useful particularly when you have a separate navigation SWF that is loaded into a shell/holder.

  1. // adjust "this.parent.parent" as needed
  2.  
  3. if(this.parent.parent != null){
  4. var parentObj:Object = this.parent.parent as Object;
  5. parentObj.traceMe()
  6. }
  7.  
  8. // in your parent SWF you will want, of course, a function like this:
  9. // function traceMe():void
  10. // {
  11. // trace("success");
  12. // }

Report this snippet  

You need to login to post a comment.