我正在使用滑块来调整图像的 alpha 属性(不透明度)。但是它没有按预期工作。当 alpha 设置为 1(即滑块上的最大值)时,图像会显示,但只要我滑动到任何小于 1 的值,图像就会完全消失。即在所有 vales btw 0 和 0.99 都没有图像...ia 猜测对于所有小于 1 的值,它将 alpha 设置为 0。我是 as3 的新手。这就是我所拥有的
包裹 {
import flash.display.*;
import flash.events.*;
import fl.controls.Slider;
import fl.events.SliderEvent;
public class PicturePanel extends MovieClip {
sliderA.width=125;
sliderA.x=425;
sliderA.y=15;
addChild(sliderA);
sliderA.addEventListener(SliderEvent.THUMB_DRAG, FnNewA);
sliderA.minimum=0;
sliderA.maximum=100;
sliderA.value=100;
pctPicture.txtA.text= "alpha = " + (sliderA.value/100);
function FnNewA(event:SliderEvent):void {
pctPicture.txtA.text=""+event.value/100;
chief.gameBoard.gameNewPctA=event.value/100;
chief.gameBoard.FnEditPicture();
}
public function FnPanelSliderStart():void {
sliderA.value=chief.gameBoard.gameNewPctA*100;
pctPicture.txtA.text=""+sliderA.value;
}
}
package
{
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import fl.motion.MatrixTransformer;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.filters.ConvolutionFilter;
import flash.text.*;
import flash.filters.DropShadowFilter;
public class GameBoard extends MovieClip
{
private var newPctA:Number = 1;
public function FnEditPicture():void
{
arraySprite[chief.gamePanel.numSprite].getChildAt(0).alpha = gameNewPctA;
}
private function FnPanelPictureStartOne():void
{
newPctA = 1;
pctPanel.FnPanelSliderStart();
}
private function FnPanelPictureStartTwo():void
{
newPctA =arraySprite[chief.gamePanel.numSprite].getChildAt(0).alpha;
pctPanel.FnPanelSliderStart();
}
public function set gameNewPctA(value:int):void
{
newPctA = value;
}
//--------------------------------------------------
public function get gameNewPctA():int
{
return newPctA;
}
}