开发者

(AS2) How to access a symbol from inside a class extends movieclip?

开发者 https://www.devze.com 2023-04-13 03:44 出处:网络
I created a movieclip symbol and exported to actionscr开发者_开发问答ipt, I created the .as file:

I created a movieclip symbol and exported to actionscr开发者_开发问答ipt, I created the .as file:

class BRIQUE extends MovieClip
{ 
  function BRIQUE()
  {
     graphics._x=10;
  }
}

"graphics" is an image imported on the stage inside my symbol, but it seems not to be accessible this way (I get an error), nevertheless it works this way in as3 then what is the right way in as2 ?

Thanks


in AS3 there is an option in Flash that says something like "automatically declare every instance on stage in my class" so Flash adds the public var graphics:MovieClip automatically. i think in AS2 you have to do this manually.

AND please use a different name for the variable - graphics is an built-in thing.

class BRIQUE extends MovieClip
{
  public var mygraphic:MovieClip

  function BRIQUE()
  {
     mygraphic._x=10;
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号