0
votes

i use an ready Accordion Panel in Flash ( here )

now when i add any button on this frame i get this error when i click Accordion tabs :

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::SimpleButton@48596ab9 to flash.display.MovieClip.

and when i add movieclip to the stage i get this error right after click on any Accordion panels :

TypeError: Error #1010: A term is undefined and has no properties.
at mobver2_fla::MainTimeline/onClick()

here is the main script for Accordion panel :

import gs.*;    
import gs.easing.*;

panel1.props = {ly:53, ry:650, ind:1};    
panel2.props = {ly:115, ry:700, ind:2};    
panel3.props = {ly:169, ry:750, ind:3};

panel1.addEventListener(MouseEvent.CLICK, onClick);    
panel2.addEventListener(MouseEvent.CLICK, onClick);    
panel3.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e:MouseEvent):void    
{    
    var clicked:MovieClip = MovieClip(e.target);

    for(var i:int=0; i<numChildren; i++)    
    {    
        var mc:MovieClip = MovieClip(getChildAt(i));

        if(mc.props.ind <= clicked.props.ind)    
            TweenLite.to(mc, 1, {y:mc.props.ly, ease:Bounce.easeOut});    
        else    
            TweenLite.to(mc, 1, {y:mc.props.ry, ease:Bounce.easeOut});    
    }    
}

it seems this script effect on all movieclip or buttons in Frame , but i cant figure it out how i must separate other buttons and movieclips from this . i really need to add some button and movie clip to these panels and frame

1

1 Answers

0
votes

The error says it all - you try to cast a button to a MovieClip, and SimpleButton is NOT a MovieClip.

This has nothing to do with the Accordion.

You need to change this line:

var clicked:MovieClip = MovieClip(e.target);

Start using debugger and traces to see what are you actually doing. Also - enable permit debugging to see on which line the error is.

We cannot help you every time you do something wrong, as this is not a common problem, nor pattern oriented, it's just a simple error of yours.