2 Replies Latest reply on Jul 13, 2009 6:54 PM by Benoitcn

    flash button controled by flex issue

    Benoitcn Level 1
      In flex I can only reference the flash button by its ID property.
      Most of the time I can't know its ID. I need cover it to a super class like MovieClip Instead of that.
      I created the button in flash by the following steps:
      design button -> cover symbol to flex component -> use it in flex
      How can I fix this ?
       <mx:Script>
        <![CDATA[
         private function clickHandler(event:MouseEvent):void
         {
            /* not work */
          MovieClip(event.target).gotoAndPlay(MovieClip(event.target).currentLabel);
           /* only this way can run */
          query.gotoAndPlay(query.currentLabel);
         }
        ]]>
       </mx:Script>
       <local:intergratedQueryButton id="query" click="clickHandler(event)" x="305" y="500"/>
      
        • 1. Re: flash button controled by flex issue
          _Natasha_ Level 4

          Hi,

           

          to be able to write

          MovieClip(event.target).gotoAndPlay(MovieClip(event.target).currentLabel);

          your button should be a subclass of MovieClip.

          If not MovieClip(event.target) will be null and will not work.

           

          So you can:

          1. Don't use types and write

          event.target.gotoAndPlay(event.target.currentLabel);

          or

          event.target.gotoAndPlay(event.target["currentLabel"]);

          2. See methods of intergratedQueryButton and if it have method gotoAndPlay use it.

          intergratedQueryButton(event.target).gotoAndPlay(intergratedQueryButton(event.target).curr entLabel);

          You can't set two superclasses, so intergratedQueryButton can be a only a Button or a MovieClip, not both.

          • 2. Re: flash button controled by flex issue
            Benoitcn Level 1

            Thanks Natasha! It works well now!

             

             

             

             

            在2009-07-13,_Natasha_ <forums@adobe.com> 写道:

            >Hi,

            >?

            >to be able to write

            >MovieClip(event.target).gotoAndPlay(MovieClip(event.target).currentLabel);

            >your button should be a subclass of MovieClip.

            >If not MovieClip(event.target) will be null and will not work.

            >?

            >So you can:

            >1. Don't use types and write

            >event.target.gotoAndPlay(event.target.currentLabel);

            >or

            >event.target.gotoAndPlay(event.target["currentLabel"]);

            >2. See methods of intergratedQueryButton and if it have method gotoAndPlay use it.

            >intergratedQueryButton(event.target).gotoAndPlay(intergratedQueryButton(event.ta rget).currentLabel);

            >You can't set two superclasses, so intergratedQueryButton can be a only a Button or a MovieClip, not both.

            >