actionscript 3 - as3 - how to define instance child from base class? -
i have movieclip parent has movieclip instances inside. movieclip parent extends baseclass, , define 1 of children using instance name , defining base class.
for example, if there child instance name of "player" inside of movieclip parent.
from movieclip parent class define as
player //or this.player
but base class, method not work. how define base class?
you can define player
in base class, have disable "automatically declare stage instances" in as3 settings. when have option checked compiler blindly tries add named instances properties of linked class. if turn off, can control properties defined. reason turn feature off.
example:
class base extends movieclip { public var player:movieclip; } class symbolclass extends base { // linked symbol contains 'player' instance }
if have "automatically declare stage instances" checked, can't because symbolclass
try automatically declare player
, conflict base
player
declaration.
also note if symbol not contain player
instance, code still valid player
null
.
Comments
Post a Comment