SharedObject的使用问题,AS3.0高手来~
就是flash的配色游戏,点一个元件这个元件是个颜色,然后再点衣服,衣服就染成那个颜色(已实现),现在想点保存按钮,把配色保存下来,然后再打开swf后点读取可以把上一次配...
就是flash的配色游戏,点一个元件这个元件是个颜色,然后再点衣服,衣服就染成那个颜色(已实现),现在想点保存按钮,把配色保存下来,然后再打开swf后点读取可以把上一次配色显示出来。
部分代码:
var game:MovieClip=null;
var w:int=0;
var mc:MovieClip;
var color:uint;
function InitLevel(m:MovieClip):void
{
for(var i:int = 1;i<=20;i++)
{
mc = m.getChildByName("a"+i);
if(mc!=null)
{
mc.addEventListener(MouseEvent.CLICK,onPaint);
}
}
}
//a1,a2,...是那些衣服裤子的元件。
function onPeekColor(e:MouseEvent):void
{
switch (e.currentTarget)
{
case btnColor1 :
color = 0xffffff;
break;
case btnColor2 :
color = 0x37AA00;
break;
case btnColor3 :
color = 0xFFD326;
break;
case btnColor4 :
color = 0x3366FF;
break;
case btnColor5 :
color = 0xFF9900;
break;
case btnColor6 :
color = 0xA852DC;
break;
case btnColor7 :
color = 0xCC0000;
break;
case btnColor8 :
color = 0xFF6ACF;
break;
case btnColor9 :
color = 0x8A5F0D;
break;
case btnColor10 :
color = 0x000000;
break;
}
var ct:ColorTransform = new ColorTransform();
ct.color=color;
xiguan.yanliao.transform.colorTransform=ct;
}
function onPaint(e:MouseEvent):void
{
var mc:MovieClip = e.currentTarget;
mc.transform.colorTransform=xiguan.yanliao.transform.colorTransform;
} 展开
部分代码:
var game:MovieClip=null;
var w:int=0;
var mc:MovieClip;
var color:uint;
function InitLevel(m:MovieClip):void
{
for(var i:int = 1;i<=20;i++)
{
mc = m.getChildByName("a"+i);
if(mc!=null)
{
mc.addEventListener(MouseEvent.CLICK,onPaint);
}
}
}
//a1,a2,...是那些衣服裤子的元件。
function onPeekColor(e:MouseEvent):void
{
switch (e.currentTarget)
{
case btnColor1 :
color = 0xffffff;
break;
case btnColor2 :
color = 0x37AA00;
break;
case btnColor3 :
color = 0xFFD326;
break;
case btnColor4 :
color = 0x3366FF;
break;
case btnColor5 :
color = 0xFF9900;
break;
case btnColor6 :
color = 0xA852DC;
break;
case btnColor7 :
color = 0xCC0000;
break;
case btnColor8 :
color = 0xFF6ACF;
break;
case btnColor9 :
color = 0x8A5F0D;
break;
case btnColor10 :
color = 0x000000;
break;
}
var ct:ColorTransform = new ColorTransform();
ct.color=color;
xiguan.yanliao.transform.colorTransform=ct;
}
function onPaint(e:MouseEvent):void
{
var mc:MovieClip = e.currentTarget;
mc.transform.colorTransform=xiguan.yanliao.transform.colorTransform;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询