1

嗨,我正在为学校准备一门课程,我想要一个页面,其中有反映数字步进器的滑块,反之亦然,但是每当我在网上找到教程时,它总是给我错误,最近的是 1120 : 未定义属性 NumericStepperEvent 的访问。我犹豫要不要继续使用其他步进器,因为我不确定如何让它工作,但我需要在星期五之前完成这部分。任何帮助都感激不尽。

谢谢马特

package 
{

import flash.display.MovieClip;
import flash.events.MouseEvent;
import fl.controls.Slider;
import fl.events.SliderEvent;
import fl.controls.Label;
import fl.controls.NumericStepper;

public class Main extends MovieClip
{
    //Variables
    var startPage:StartPage;
    var tutorialPage:TutorialPage;
    var maleSizePage:MaleSizePage;
    var femaleSizePage:FemaleSizePage;

    public function Main()
    {

        //Pages
        startPage = new StartPage  ;
        tutorialPage = new TutorialPage  ;
        maleSizePage = new MaleSizePage  ;
        femaleSizePage = new FemaleSizePage  ;

        addChild(startPage);

        //Event Listeners
        startPage.startButton.addEventListener(MouseEvent.CLICK,startButtonClick);
        tutorialPage.continueButton.addEventListener(MouseEvent.CLICK,tutorialContinueButtonClick);
        maleSizePage.heightSlider.addEventListener(SliderEvent.CHANGE,heightSlChange_M);
        maleSizePage.neckSlider.addEventListener(SliderEvent.CHANGE,neckSlChange_M);
        maleSizePage.chestSlider.addEventListener(SliderEvent.CHANGE,chestSlChange_M);
        maleSizePage.waistSlider.addEventListener(SliderEvent.CHANGE,waistSlChange_M);
        maleSizePage.armSlider.addEventListener(SliderEvent.CHANGE,armSlChange_M);
        maleSizePage.legSlider.addEventListener(SliderEvent.CHANGE,legSlChange_M);
        maleSizePage.heightValue.addEventListener(NumericStepperEvent.CHANGE,heightVChange_M);          
    }



    function startButtonClick(event:MouseEvent):void
    {
        addChild(tutorialPage);
    }
    function tutorialContinueButtonClick(event:MouseEvent):void
    {
        if (startPage.maleSelection.selected == true)
        {
            addChild(maleSizePage);
            removeChild(startPage);
            removeChild(tutorialPage);
        }
        if (startPage.femaleSelection.selected == true)
        {
            addChild(femaleSizePage);
            removeChild(startPage);
            removeChild(tutorialPage);
        }
    }

    function heightSlChange_M(Event:SliderEvent):void
    {

        maleSizePage.heightValue.value = maleSizePage.heightSlider.value;
    }
    function neckSlChange_M(Event:SliderEvent):void
    {

        maleSizePage.neckValue.value = maleSizePage.neckSlider.value;

    }
    function chestSlChange_M(Event:SliderEvent):void
    {

        maleSizePage.chestValue.value = maleSizePage.chestSlider.value;

    }
    function waistSlChange_M(Event:SliderEvent):void
    {

        maleSizePage.waistValue.value = maleSizePage.waistSlider.value;
    }
    function armSlChange_M(Event:SliderEvent):void
    {

        maleSizePage.armValue.value = maleSizePage.armSlider.value;
    }
    function legSlChange_M(Event:SliderEvent):void
    {

        maleSizePage.legValue.value = maleSizePage.legSlider.value;
    }
    function heightVChange_M(Event:NumericStepper)
    {
        maleSizePage.heightSlider.value = maleSizePage.heightValue.value;
    }

}

}

4

1 回答 1

0

您需要告诉编译器要使用哪些类。目前它不知道 NumericStepperEvent 是什么。

在顶部添加其他导入添加: import mx.events.NumericStepperEvent;

另外我建议将参数变量更改Event:SliderEvent为小写event:SliderEvent,因为这可能会导致另一个编译器错误。

于 2014-01-22T02:38:48.050 回答