A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: prototype functions & loaded movies

  1. #1
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Hi...

    I have added some custom functions to movie clips via the prototype method (in level0)...and I'm just curious whether these functions will be inherited by movie clips in loaded movies on higher levels...or whether each movie needs to include it's own prototype function declarations...

    TIA,

    K.

  2. #2
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    prototype method?

    whats that?

    If your function is resident in _level0 then it won't be resident in any other _level unless you put it there also....
    you can always call a function from anywhere though:

    _level0.functionName(args);

  3. #3
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    turned to the manual,
    yeah I get it, very cool method
    I don't think it applies across _levels, but I'd give it a try anyway (you never know with flash)
    I'm pretty sure it only gets applied to instances created with the custom function,
    and it looks to me like you also have to pass inheritence -
    name the prototype properties of a function so that any new objects it creates can use the __proto__ values
    cool to play with
    8)

  4. #4
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Hi...

    Having done a bit of testing on this, it appears that the scope of the prototype functions is the Flash Player instance itself...so as long as one of the loaded movies declares the custom functions, they are accessible to all loaded levels...



    K.


  5. #5
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    All *movieclips* can use the functions you set in the Movieclip prototype object:

    Code:
    Movieclip.prototype.tracer=function(){
        trace("im saying hello from +"this)
    }
    _level1.tracer()

  6. #6
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    *cool

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