Flash AS 3.0 。1120:访问的属性g1未定义
package{importflash.display.MovieClip;publicclassguandaoextendsMovieClip{publicvarhei...
package {
import flash.display.MovieClip;
public class guandao extends MovieClip {
public var heights:int;
public function guandao()
{
// constructor code
heights=Math.floor(Math.random()*(230+1));
g1.height=heights-24;
}
}
}
反复报错,但是和别人的代码一毛一样。。求大神解答 展开
import flash.display.MovieClip;
public class guandao extends MovieClip {
public var heights:int;
public function guandao()
{
// constructor code
heights=Math.floor(Math.random()*(230+1));
g1.height=heights-24;
}
}
}
反复报错,但是和别人的代码一毛一样。。求大神解答 展开
2个回答
展开全部
package {
import flash.display.MovieClip;
public class guandao extends MovieClip {
public var heights:int;
public var g1:MovieClip; //添加
public function guandao()
{
// constructor code
g1 = getChildByName("g1") as MovieClip; //添加
heights=Math.floor(Math.random()*(230+1));
g1.height=heights-24;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询