Groups | Blog | Home
all groups > flash actionscript > january 2004 >

flash actionscript : Call/Declare Functions



Myrddraal
1/29/2004 9:23:42 PM
I've got a movieclip that has some various functions declared inside of it like init(), etc...those work great. Then inside of that movieclip I have another movieclip called topBar and it has it's own functions like initBar(). Those do NOT work. In the first movieclip if I do: topBar.initBar(); it just simply does not work at all. Why would it not recoginze functions declared in that 2nd movieclip? I declare the functions like this:
initBar = function() { blah...}

and I've even tried:

this.initBar = function() { blah... }

and neither work. why?

-Jason Kringen

Jack.
1/29/2004 11:23:22 PM
have you tried keeping all functions on the main timeline ?

the first clip action would then be - _parent.init();
and the nested clip - _parent._parent.initBar();

my2c's

regards
CesareRocchi
1/30/2004 12:29:17 PM
It is a matter of path for sure.
The player doesn't find the function when you call it. Try to add some trace or see the list of objects/variables in the plyer IDE (see debug menu).



Myrddraal
1/30/2004 3:55:46 PM
ok. I'll try maybe putting them on the main timeline and see how that effects things. I just think it's strange that I can declare functions in one movie clip that work fine, but then in another, they won't work at all. Is that a common problem when you have a movie nested inside of another movie?

-Jason

CesareRocchi
1/30/2004 8:55:31 PM
When you have a mc nested in another one usually mistakes are in the way you refer to object (because even functions are a type of object).

One way to discover where functions/objects are is to trace them or locate them by means of List objects/variables.

-c.

AddThis Social Bookmark Button