Resize External swf - actionscript-3

I'm writing an android app in flex as I need to display swf animations.
These swf files are larger than the mobile screen - they're advertisements used elsewhere.
I don't seem to be able to resize the loaded swf file. I've set height and width on the container, the loader everywhere I can think of and nothing changes the size of the swf.
It's frustrating, the swf is of a set size as they display full screen when used as advertisements, I just want to show a small preview within the app of what they will look like.
I'm beginning to think that it cannot be done? or am I missing something
I've seen similar questions asked here, but no answer that works for me.

There is only one stage, and the loaded swf probably resizes itself according to the stage dimensions, so it ignores the properties of the loader.
If you can modify the code of the loaded swf, you can:
either add it a method like setSize(width, height), and invoke it from the main swf:
yourSWFLoader.content.setSize(width, height);
or access to the loader dimensions from the loaded swf, using something like:
width = parent.parent.width;
height = parent.parent.height;
The second solution assumes the SWF is loaded from a trusted domain.

Related

how to make existing flash file responsive

I have e learning books in flash file(.swf format) and i want to make it responsive.Can any one suggest a solution for this.please refer the link flash file
If you open the raw swf files in a browser, you can see that they are already responsive by default: http://rtpublishers.com/data/Hindi/Book1/pages/page1.swf
So, you need to change the way the Flash is embedded in your html page. Where you are using fixed 1300 x 900 pixels dimensions, use percentages instead.
In your Flash file, you can set the stage scaleMode = StageScaleMode.EXACT_FIT as explained here:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS0D75B487-23B9-402d-A52D-CB3C4CEB9EE4.html
If there are parts of the Flash that you want to scale differently depending on stage size, you can listen to the stage RESIZE event, and respond accordingly.

Why is my flash animation getting cropped?

You can view the swf file here :-
http://shrineweb.in/other-files/other/seniorschool.swf
On the above link, the swf is not getting trimmed and plays fine. But when you download it and view in the flash player, it gets trimmed a little from all sides. You will notice that by seeing the half cut 'skip' button at top-right.
Does anyone have any idea why this is happening?
Your SWF file is published with stage dimensions of 800x650, make sure that your content doesn't exceed those bounds. If it does, change your stage size in your document properties.

Embedded SWF: Finding the framerate of the child SWF

I have a program that dynamically loads SWFs a user has uploaded to a server into another, larger, SWF. This means the embedded SWF can be any framerate and I have no control or knowledge of what is being uploaded.
What I want to do is show a message to the user that the framerate does not match the parent SWFs framerate and that it might playback too quickly or slowly.
However, when I try to find the framerate (using swfLoader.loaderInfo.frameRate) it only displays the parent's framerate, because the child's has been changed.
I need a way to find the framerate the original child SWF was set to before it was changed by the parent.
I tried going to Google for this issue, but nothing turned up a working solution to this problem.
You should use contentLoaderInfo.frameRate instead.

How to modify the size of Flash stage programmatically

Initially I set the stage width 500 and height 400. After make a file, now I want it to be 700*500 and I want to show all content in stage. How can I achieve this?
Any help will be appreciated.
If it's a website you're creating you can programmatically control its size via call through a class called ExternalInterface which in turn calls JavaScript-functions. JavaScript can then be used to resize the embedded flash object.
You can find another post about this here: How can I resize a swf during runtime to have the browser create html scrollbars?

Need to dynamically alter the main timeline display dimension to match a loaded 3D swf's dimension to keep source 3D properties?

The issue I'm having is that I have a main "wrapper" 100x100 (but it could be any size) - it's just there to hold and display whatever content, swf, gif, etc we may want to throw into it. As long as the loaded content doesn't have 3D animation like rotationY going on, it displays fine. But when it does, the 3D "anchor" properties (like projectionCenter) of the loaded swf inherit those of the main timeline (i.e. 100x100 (main) vs 728x90 (loaded)). If I change the dimension of the main "wrapper" in Flash IDE to match what's coming in - the 3D behaves fine, but I won't know what the dimensions of the content will be until it comes, so I need a way (if there is one) to dynamically alter the main "wrapper" or root display object through AS. Stuff like "this.width = loader.width" or "stage.width = loader.width" or "root.width = loader.width" etc doesn't work. Flex has the hBox and vBox - does AS have anything?
Use ExternalInterface to call a javascript function in the wrapper html, this will change the dimensions of the height/width of the enclosing div that wraps your .swf embd (Embed at width="100%" and height="100%") alternatively use swfobject to get a handle on the embedded object and change the height/width properties to match.
Then you can attach a Event.RESIZE listener and reposition your elements when the swf has been resized to fit the contents.
This is an example (Though just the height of the swf is changing) http://www.markgriffo.com/scrollTest/