4 Replies Latest reply on Jan 4, 2011 10:01 PM by nicoladinh

    SWFLoader.load() and sizing problem

    nicoladinh

      hi guys,,

       

      this is my mxml:

      <mx:SWFLoader id="my_swf" source="blah_blah.swf" width="100" height="100"/>

       

      the actual size of "blah_blah.swf" is 200x200,

      when i want to replay the swf, i call this code:

       

      my_swf.load();

       

      but this is the point making problem, flex resets back my clip to

      the original size which is 200x200

       

      note that without calling "my_swf.load();" the clip showing correctly 100x100

       

      please guide me to learn why.....

        • 1. Re: SWFLoader.load() and sizing problem
          learner_doug Level 1

          I resize my external swfs with scaleX and scaleY to chang the size.  Not sure if this is what you are after.  But I use the mx:SWFloader most of the time and call the swfs with swfLoader.load("bla_bla.swf");

           

          Perhaps this helps a bit.

          • 2. Re: SWFLoader.load() and sizing problem
            nicoladinh Level 1

            it seems like "my_swf.load();" will set my_swf to null

            because of lacking file path, that could be the problem?

            • 3. Re: SWFLoader.load() and sizing problem
              learner_doug Level 1

              Might need to add a path to your URL.  From your example, I'm not sure how you are getting the actual swf to load - I don't see a reference to it, but here is an example that includes all the pieces you need.

               

              1. with a

              <mx:SWFLoader id = "loader" scaleX="someValue" scaleY="someValue" />

              somewhere in your application/component

               

              2.  The following code in your <mx:Script> section:

               

              some function(event:SomeEvent):void  //  note that "SomeEvent" needs to be specific, either a MouseEvent (if mouse click), or other real Flex Event)

              {

              loader.load("path/bla_bla.swf");

                   loader.x = someValue;  //places the swf where you want it

                   loader.y = someValue;  //places the swf where you want it

              }

              • 4. Re: SWFLoader.load() and sizing problem
                nicoladinh Level 1

                my path to the swf is correct as it is shown on the stage,

                however, what i wonder is why after calling "my_swf.load()"

                the swf on stage is resized back to the original size

                 

                code:

                <mx:SWFLoader id="my_swf" source="blah_blah.swf" width="100" height="100"/>

                 

                ...

                my_swf.load(); //it resizes itself back to original size 200x200 here