A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic function call

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    175

    Dynamic function call

    (Using Flash 5)

    I'm trying to find a way to dynamically call functions so that I can easily write scripts for my game engine. The idea is that each script would be an array of function calls with arguments and an event on which to move the header forward. Anyway, I found a way to call functions with 1 or 0 arguments, by making each function call an array(function_reference[,argument]) and using array[0](array[1]). However, the commas required for multiple arguments present a problem. Can anyone think of a way to do this?

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    175
    First of all, bump.

    Second, I fixed that problem, but I've got a new function dilemma now. I'm calling a function on the root within a function within an MC. Diagram:
    Code:
     root
      | \
     MC  -function explode()
      |
     function nextevent() {
      _root.explode();
     }
    Anyway, the problem is that explode(), as called within nextevent(), acts as though the code were written in MC. So when I reference movie clips relatively, they naturally don't exist, which causes problems (self duplication, etc). This hasn't happened before - I have other movie clips that call _root.explode(), and the code is executed from the root like it should be. Anyone know what's up/how to get around it?

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