6 Replies Latest reply on Mar 11, 2010 1:47 AM by tyree_2

    using flash(swf files) as textures with 3d models

    martingr

      I have noticed that a Flash (.swf) file can be used as a texture on a 3d

      model (eg; as a shader surface on a cube), however the animation doesn't play

      (not automatically anyway) it just appears as a static image.

      Is it possible to play/control the .swf whilst using it in this manner?

        • 1. Re: using flash(swf files) as textures with 3d models
          tyree_2 Level 2

          unless something has changed there is a trick to it. where you dont play it normally. you use lingo and copy every frame of flash and paste it on as a texture.

          • 2. Re: using flash(swf files) as textures with 3d models
            tyree_2 Level 2

            property my3D, tv, flashRef, flasImg

            property frameCnt, currFrame, texRef

             

            on beginSprite me

            my3D = sprite(me.spriteNum).member

            tv = my3D.model("screen")

            flashRef = member("color-sphere")

            flashImg = flashRef.image

            frameCnt = flashRef.frameCount

            currFrame = 1

            texRef = my3D.newTexture("tv", #fromImageObject, flashImg)

            tv.shader.texture = texRef

            end

             

            on exitFrame

            currFrame = currFrame + 1

            if currFrame > frameCnt then currFrame = 1

            flashRef.posterFrame = currFrame

            texRef.image = flashRef.image

            end

             

            on endSprite me

            my3D.resetWorld()

            end

             

             

            my 3d is w3d, tv is the model that will play flash, flash ref is the flash file. everything else copies, places and plays the flash. all this code goes on the sprite

            • 3. Re: using flash(swf files) as textures with 3d models
              Sean_Wilson Adobe Community Professional

              It depends on how your Flash file is put together.

               

              If it's a straight-forward linear animation on _root then you can set member.posterFrame (and possibly member.defaultRect - once - to guarantee powers-of-two) and grab member.image

               

              If the animation is on a different timeline I think you'll need a sprite to display it and grab the image of the stage containing the sprite, or play it in a MIAW (if you're running a projector). If you're running in a browser you can use the HTML to crop the stage and display the sprite out of the visible area.

               

              If you have interactivity then it's still possible, but you're going to need to know lots about where buttons and other interactive elements are located on the Flash stage and how to communicate with them via Lingo.

              • 4. Re: using flash(swf files) as textures with 3d models
                tyree_2 Level 2

                Ive been able to use it without having to put it on stage. using it as a source in the cast. doesnt it affect the performance somewhat when it has to be placed on the stage in order to be used

                • 5. Re: using flash(swf files) as textures with 3d models
                  Sean_Wilson Adobe Community Professional

                  Ive been able to use it without having to put it on stage. using it as a source in the cast.

                  I didn't say you couldn't. In fact we both do the same thing: set the posterFrame and grab the image of the member.

                   

                  doesnt it affect the performance somewhat when it has to be placed on the stage in order to be used

                  Yes, potentially. What I was driving at is that there are circumstances where the posterFrame/image option may not work - specifically where user-interaction or animation in movieClips becomes involved

                  • 6. Re: using flash(swf files) as textures with 3d models
                    tyree_2 Level 2

                    have you ever been able to play a flash file on the backdrop or overlay