r/actionscript • u/pagios • Jan 12 '19
Button object definition problem
Concerning MovieClip objects, If, for example I have 2 moviclip objects in my library: obj1 & obj2, I can define a variable as MovieClip, then decide later which object from the library to assign it to and add it to the stage:
var myobject: MovieClip;
myobject = new obj2();
addChild(myobject);
However this does not seem to work with Button objects. I have tried:
var myobject: Object;
> 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
var myobject: Button;
> 1046: Type was not found or was not a compile-time constant: Button
Any ideas?
Thanks
View all comments
Show parent comment
2
u/pagios Jan 13 '19
worked like a charm!
thank you!