Loading ...
Sorry, an error occurred while loading the content.

MovieClip management

Expand Messages
  • thunder0ne
    Hi all, how do I trigger or stop animations? That is, i have an IsoSprite whose sprite is loaded from an external swf as a Class object. This sprite has an
    Message 1 of 7 , Jun 3, 2009
    View Source
    • 0 Attachment
      Hi all,
      how do I trigger or stop animations? That is, i have an IsoSprite whose sprite is loaded from an external swf as a Class object.
      This sprite has an animation which I want to trigger or stop.
      How can I achieve this?

      Many thanks.
    • as3isolib
      Right now the IsoSprite doesn t fully wrap the APIs of a MovieClip. So instead you have to drill down to it and directly tap those APIs like so:
      Message 2 of 7 , Jun 3, 2009
      View Source
      • 0 Attachment
        Right now the IsoSprite doesn't fully wrap the APIs of a MovieClip. So instead you have to drill down to it and directly tap those APIs like so:

        isoSpriteInstance.container.getChildAt(#).stop();

        or you can also do it this way:

        isoSpriteInstance.actualSprites[0].stop(); //assuming you have only one asset.

        Future APIs will probably allow the IsoSprite class to wrap some of the movieclip APIs with more ease. Its just something that hasn't become a top focus. If you have an immediate need though, file a feature request with your proposed API on the project site and we can see about implementing something.

        --- In as3isolib@yahoogroups.com, "thunder0ne" <Thunder0@...> wrote:
        >
        > Hi all,
        > how do I trigger or stop animations? That is, i have an IsoSprite whose sprite is loaded from an external swf as a Class object.
        > This sprite has an animation which I want to trigger or stop.
        > How can I achieve this?
        >
        > Many thanks.
        >
      • thunder0ne
        Thanks for the suggestions, I am starting to try them but I have the suspect that some problems can rise since on each render call the render function actually
        Message 3 of 7 , Jun 4, 2009
        View Source
        • 0 Attachment
          Thanks for the suggestions,
          I am starting to try them but I have the suspect that some problems can rise since on each render call the render function actually creates new instances of DisplayObject corresponding to the graphic asset of the IsoSprite, therefore I am afraid that when I trigger play or stop for the child of the mainContainer of the IsoSprite that can refer to a different instance of a moviclip that is actually rendered on screen.
          Is creating new instances of DisplayObject on each frame necessary?
          Is this an actual problem? How could I overcome it?

          Many thanks



          --- In as3isolib@yahoogroups.com, "as3isolib" <as3isolib@...> wrote:
          >
          > Right now the IsoSprite doesn't fully wrap the APIs of a MovieClip. So instead you have to drill down to it and directly tap those APIs like so:
          >
          > isoSpriteInstance.container.getChildAt(#).stop();
          >
          > or you can also do it this way:
          >
          > isoSpriteInstance.actualSprites[0].stop(); //assuming you have only one asset.
          >
          > Future APIs will probably allow the IsoSprite class to wrap some of the movieclip APIs with more ease. Its just something that hasn't become a top focus. If you have an immediate need though, file a feature request with your proposed API on the project site and we can see about implementing something.
          >
          > --- In as3isolib@yahoogroups.com, "thunder0ne" <Thunder0@> wrote:
          > >
          > > Hi all,
          > > how do I trigger or stop animations? That is, i have an IsoSprite whose sprite is loaded from an external swf as a Class object.
          > > This sprite has an animation which I want to trigger or stop.
          > > How can I achieve this?
          > >
          > > Many thanks.
          > >
          >
        • thunder0ne
          I added the following to IsoSprite class as a temporary workaround and it works. protected var _movieClip : MovieClip ; public function
          Message 4 of 7 , Jun 4, 2009
          View Source
          • 0 Attachment
            I added the following to IsoSprite class as a temporary workaround and it works.


            protected var _movieClip : MovieClip ;

            public function gotoAndPlayAnimation(frameNum : int):void {
            if (_movieClip == null) {
            var movieClip : MovieClip = mainContainer.getChildAt(0) as MovieClip;
            _movieClip = movieClip;
            }
            _movieClip.gotoAndPlay(frameNum);
            }

            public function gotoAndStopAnimation(frameNum : int):void {
            if (_movieClip == null) {
            var movieClip : MovieClip = mainContainer.getChildAt(0) as MovieClip;
            _movieClip = movieClip;
            }
            _movieClip.gotoAndStop(frameNum);
            }

            I will see later about the feature request or post a more proper solution.

            Thanks.

            --- In as3isolib@yahoogroups.com, "thunder0ne" <Thunder0@...> wrote:
            >
            > Thanks for the suggestions,
            > I am starting to try them but I have the suspect that some problems can rise since on each render call the render function actually creates new instances of DisplayObject corresponding to the graphic asset of the IsoSprite, therefore I am afraid that when I trigger play or stop for the child of the mainContainer of the IsoSprite that can refer to a different instance of a moviclip that is actually rendered on screen.
            > Is creating new instances of DisplayObject on each frame necessary?
            > Is this an actual problem? How could I overcome it?
            >
            > Many thanks
            >
            >
            >
            > --- In as3isolib@yahoogroups.com, "as3isolib" <as3isolib@> wrote:
            > >
            > > Right now the IsoSprite doesn't fully wrap the APIs of a MovieClip. So instead you have to drill down to it and directly tap those APIs like so:
            > >
            > > isoSpriteInstance.container.getChildAt(#).stop();
            > >
            > > or you can also do it this way:
            > >
            > > isoSpriteInstance.actualSprites[0].stop(); //assuming you have only one asset.
            > >
            > > Future APIs will probably allow the IsoSprite class to wrap some of the movieclip APIs with more ease. Its just something that hasn't become a top focus. If you have an immediate need though, file a feature request with your proposed API on the project site and we can see about implementing something.
            > >
            > > --- In as3isolib@yahoogroups.com, "thunder0ne" <Thunder0@> wrote:
            > > >
            > > > Hi all,
            > > > how do I trigger or stop animations? That is, i have an IsoSprite whose sprite is loaded from an external swf as a Class object.
            > > > This sprite has an animation which I want to trigger or stop.
            > > > How can I achieve this?
            > > >
            > > > Many thanks.
            > > >
            > >
            >
          • as3isolib
            with regards to creating the sprite assets on every render call, it does not recreate the assets on every render pass. There are invalidation flags that are
            Message 5 of 7 , Jun 4, 2009
            View Source
            • 0 Attachment
              with regards to creating the sprite assets on every render call, it does not recreate the assets on every render pass.  There are invalidation flags that are checked to prevent unnecessary processing.  Now if you are seeing something to the contrary, please let me know because mistakes do happen ;)

              Regarding your fix, I do like what I see, however I was thinking something a bit more robust regarding that certain IsoSprites can actually have more than one display object.  There is this idea that you could check to see how many sprite assets are within the IsoSprite, if there is more than one, there is an optional parameter to target the index of that child, otherwise it may affect all children if possible.
            • thunder0ne
              Sorry for late replying. it works as designed, that is the assets are not recreated on each rendering but only on invalidation. About the fix it is really
              Message 6 of 7 , Jun 8, 2009
              View Source
              • 0 Attachment
                Sorry for late replying.
                it works as designed, that is the assets are not recreated on each rendering but only on invalidation.
                About the fix it is really quick and dirty, I hope to be able to post something better later.


                --- In as3isolib@yahoogroups.com, as3isolib <as3isolib@...> wrote:
                >
                > with regards to creating the sprite assets on every render call, it does not
                > recreate the assets on every render pass. There are invalidation flags that
                > are checked to prevent unnecessary processing. Now if you are seeing
                > something to the contrary, please let me know because mistakes do happen ;)
                >
                > Regarding your fix, I do like what I see, however I was thinking something a
                > bit more robust regarding that certain IsoSprites can actually have more
                > than one display object. There is this idea that you could check to see how
                > many sprite assets are within the IsoSprite, if there is more than one,
                > there is an optional parameter to target the index of that child, otherwise
                > it may affect all children if possible.
                >
              • as3isolib
                Please do. I welcome any and all community input regarding the APIs so once you feel it s up to snuff, send us something for review.
                Message 7 of 7 , Jun 8, 2009
                View Source
                • 0 Attachment

                  Please do.  I welcome any and all community input regarding the APIs  so once you feel it's up to snuff, send us something for review.


                  On Mon, Jun 8, 2009 at 4:00 AM, thunder0ne <Thunder0@...> wrote:


                  Sorry for late replying.
                  it works as designed, that is the assets are not recreated on each rendering but only on invalidation.
                  About the fix it is really quick and dirty, I hope to be able to post something better later.



                  --- In as3isolib@yahoogroups.com, as3isolib <as3isolib@...> wrote:
                  >
                  > with regards to creating the sprite assets on every render call, it does not
                  > recreate the assets on every render pass. There are invalidation flags that
                  > are checked to prevent unnecessary processing. Now if you are seeing
                  > something to the contrary, please let me know because mistakes do happen ;)
                  >
                  > Regarding your fix, I do like what I see, however I was thinking something a
                  > bit more robust regarding that certain IsoSprites can actually have more
                  > than one display object. There is this idea that you could check to see how
                  > many sprite assets are within the IsoSprite, if there is more than one,
                  > there is an optional parameter to target the index of that child, otherwise
                  > it may affect all children if possible.
                  >


                Your message has been successfully submitted and would be delivered to recipients shortly.