Class solution required

ok im just starting to use prototypes in my AS programming…
so naturally, ive started using a custom class.
i read some of senoculars great (and very in-depth) tutorial on OOP in AS1 programming… and (if not in there, somewhere else) it said that there were problems with creating custom classes because they had to be defined on the frame prior to the creation of the movieclip or something…

so i thought i would create a dummy frame before my mc and in this dummy frame have a gotoAndStop(2) after my code defining my custom class… but this didnt work…

the thing is, i know my class code is ok because if i preview it twice, the first time the custom class actions return undefined but the second time they return theyr appropriate values (because the class was defined before the second creation of the mc)

i tried using initclip but this seemed to prevent me from returning proper values, ie. i have a getPerc proto function which returns an integer between 0 and 100. if i have the custom class without the #initclip and preview it at least twice i get the correct values, but if i incorporate the #initclip i only ever get 0 returned… but i get it on the first preview as well…

so i was wondering what your solutions/work-arounds were… [size=1](and if i could steal it! :wink: lol)[/size]

Prophet.

can you show what you’re using?

function TTAclass(){}
TTAclass.prototype = new MovieClip()
TTAclass.prototype.onComplete = function(funcID){
	this.onEnterFrame=function(){
		if(!runOnce){
			if(complete){
				_root[funcID.toString()]()
				runOnce=1
			}
		}
	}
}

Object.registerClass("TextTyperAlpha",TTAclass)

by the way, i swapped them out (there were more proto functins but in the same format) for regular functions which works perfectly… seeing as its a component i dont really need the prototype version but im learning so it would be cool to have that kinda stuff in it :wink:

i have that on frame 1 of the mc. It has no other frames but has another mc in this component. Complete is a variable returned as true once its completed (duuh lol)

doesnt work first Ctrl+Enter but works subsequent Ctrl+Enters…

was wondering what other ppls work-arounds were…
not hugely important nemore but still b nice 2 no! :wink:

Prophet.

the component mc? If its defining the component then it would need to go between the #initclip and #endinitclip tags (and make sure its exported for actionscript in the library)

the prototyped functions are called after the components bn initialised and when i put it in the #initclip and #endinitclip they dont work properly. its as if they retrieve the values once during the initialisation of the component and once only… any idea why that is?

thanks for the help sen!

Prophet.