mercredi 4 janvier 2017

AS3 - TypeError: Error #1009 "null" at MethodInfo

I have a very similar project. Frames that change every time I click button, and a simulation of progress bar inside arrows.

stop();
/** initializtios **/
var trans:ColorTransform = next_arrow.transform.colorTransform;
var p:int = 1;

var myColorTransform = new ColorTransform();
myColorTransform.color = 0x42f498;
var trans1:ColorTransform = back_arrow.transform.colorTransform;

/** actual code **/
btn_next_arrow.addEventListener(MouseEvent.CLICK, function goNextLectFrame(e:MouseEvent):void {
    if (p==1) {
        fill_1.transform.colorTransform = myColorTransform;
        fill_22.alpha = 0.00001;
        fill_3.alpha = 0.00001;
        fill_33.alpha = 0.00001;
        fill_5.alpha = 0.00001;
        fill_6.alpha = 0.00001;
        fill_7.alpha = 0.00001;
        fill_8.alpha = 0.00001;
        fill_9.alpha = 0.00001;
        fill_10.alpha = 0.00001;
        fill_11.alpha = 0.00001;
        fill_12.alpha = 0.00001;
        fill_13.alpha = 0.00001;
        fill_14.alpha = 0.00001;
        fill_151.alpha = 0.00001;
        ++p;
    }
    switch (currentFrame) {
        case 1:
            gotoAndStop(2);
            break;
        case 2:
            fill_22.transform.colorTransform = myColorTransform;
            gotoAndStop(3);
            break;
        case 3:
            fill_3.transform.colorTransform = myColorTransform;
            gotoAndStop(4);
            break;
        case 4:
            fill_33.transform.colorTransform = myColorTransform;
            gotoAndStop(5);
            break;
        case 5:
            fill_5.transform.colorTransform = myColorTransform;
            gotoAndStop(6);
            break;
        case 6:
            fill_6.transform.colorTransform = myColorTransform;
            gotoAndStop(7);
            break;
        case 7:
            fill_7.transform.colorTransform = myColorTransform;
            gotoAndStop(8);
            break;
        case 8:
            fill_8.transform.colorTransform = myColorTransform;
            gotoAndStop(9);
            break;
        case 9:
            fill_9.transform.colorTransform = myColorTransform;
            gotoAndStop(10);
            break;
        case 10:
            fill_10.transform.colorTransform = myColorTransform;
            gotoAndStop(11);
            break;
        case 11:
            fill_11.transform.colorTransform = myColorTransform;
            gotoAndStop(12);
            break;
        case 12:
            fill_12.transform.colorTransform = myColorTransform;
            gotoAndStop(13);
            break;
        case 13:
            fill_13.transform.colorTransform = myColorTransform;
            gotoAndStop(14);
            break;
        case 14:
            fill_14.transform.colorTransform = myColorTransform;
            gotoAndStop(15);
            break;
        case 15:
            fill_151.transform.colorTransform = myColorTransform;
            gotoAndStop(16);
            break;
        case 16:
            gotoAndStop(17);
            break;
    }
});

btn_next_arrow.addEventListener(MouseEvent.MOUSE_OVER, function hovering(e:MouseEvent):void {
    trans.color = uint(0x606266);
    next_arrow.transform.colorTransform = trans;
});

btn_back_arrow.addEventListener(MouseEvent.MOUSE_OVER, function hovering1(e:MouseEvent):void {
    trans1.color = uint(0x606266);
    back_arrow.transform.colorTransform = trans1;
});

btn_next_arrow.addEventListener (MouseEvent.MOUSE_OUT, function hideShadow(event:MouseEvent):void {
    trans.color = uint(0x999999);
    next_arrow.transform.colorTransform = trans;
});

btn_back_arrow.addEventListener (MouseEvent.MOUSE_OUT, function hideShadow1(event:MouseEvent):void {
    trans1.color = uint(0x999999);
    back_arrow.transform.colorTransform = trans1;
});

btn_back_arrow.addEventListener(MouseEvent.CLICK, function goPrevLectFrame(e:MouseEvent):void {
        switch(currentFrame){
        case 2:
            gotoAndStop(1);
            break;
        case 3:
            gotoAndStop(2);
            break;
        case 4:
            gotoAndStop(3);
            break;
        case 5:
            gotoAndStop(4);
            break;
        case 6:
            gotoAndStop(5);
            break;
        case 7:
            gotoAndStop(6);
            break;
        case 8:
            gotoAndStop(7);
            break;
        case 9:
            gotoAndStop(8);
            break;
        case 10:
            gotoAndStop(9);
            break;
        case 11:
            gotoAndStop(10);
            break;
        case 12:
            gotoAndStop(11);
            break;
        case 13:
            gotoAndStop(12);
            break;
        case 14:
            gotoAndStop(13);
            break;
        case 15:
            gotoAndStop(14);
            break;
        case 16:
            gotoAndStop(15);
            break;
        }
});

btn_main_menu.addEventListener(MouseEvent.CLICK, function goPrevLectFrame1(e:MouseEvent):void {
    gotoAndStop(17);
});

The problem is when I get to the last frame and click the next button, it says:

TypeError: Error #1009: ... "null". at Function/()[RECOVER_shitty_fla.MainTimeline::frame1:114]

That's a problem causing function:

btn_next_arrow.addEventListener (MouseEvent.MOUSE_OUT, function hideShadow(event:MouseEvent):void {
    trans.color = uint(0x999999);
    next_arrow.transform.colorTransform = trans; // LINE 114
});

I'm really struggling here, will appreciate any help, thank in advance.

P.S. Maybe its gonna help, link to the project and swf.

Aucun commentaire:

Enregistrer un commentaire