A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Help calling a class function from the timeline of a nested movie clip

  1. #1
    Axis Games Djugan's Avatar
    Join Date
    Oct 2003
    Posts
    238

    Help calling a class function from the timeline of a nested movie clip

    Hey guys,

    I'm trying to call a function called checkForHit() located inside of my Hero class at a particular frame of an attack animation of my Hero object. Meaning, when his weapon is at the point in the animation where it could collide with any enemies, I want to call the function that performs the check.

    My Hero Movie Clip is set up where it contains a Movie Clip on different frames that coorespond to the different animations (attacks, movements, etc). So the Hero MC contains a bunch of other MCs. That way I can just use hero.gotoAndStop("attack1");

    The problem that I'm having is that the code that I wrote to call the checkForHit() function is written on one of the frame of the nested MC's timeline, and it's not being recognized. In fact, even if I put a trace("HELLO") on any of the frames on the nested MC, it's not being output. I even tried to put something that I know should cause an error on one of the frames, and it ran without throwing an error. It's almost like the code on the timeline isn't being compiled, or it's being skipped over somehow.

    Any thoughts would be greatly appreciated!

  2. #2
    Axis Games Djugan's Avatar
    Join Date
    Oct 2003
    Posts
    238
    RESOLVED

    Exporting the Hero object on the first frame fixed the problem. I guess it didn't have time to load all of the nested clips, so it was never reading or running the code.

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