Actionscript 2.0 External SWF loaded and resized into Movieclip problem - actionscript-2

Even if I loaded for dozen times an external swf into a movieclip... I dont know how to resize (layout) the targeted movieclip. I dont mean the quality... Let`s say the external SWF has 400 X 300 px and I want it to be loaded into a movieclip container about 200X100. How to resize the external SWF file prior to be loaded? Please HELP ! I know that in AS 3 there is some code with x/y variables... But my external SWF and the main page (in whic I want the swf to be loaded) are in AS 2. Anyone pls Help :) Thanks!

Lets call the container SWF mc_a and the SWF to be loaded mc_b.
Create another container SWF inside of mc_a. We'll call it mc_c for this discussion.
At runtime, set the visibility of mc_c to false.
Load mc_b into mc_c.
mc_c will assume the width and height of the loaded SWF, mc_b, but it will be invisible at this point.
Set the width and height of mc_c according to what you want.
Set the visibility of mc_c to true.
That should do it, or some similar variation of that. You could also forgo the inner container, mc_c, and just set the visibility of mc_a to false at runtime, load mc_b into it, resize mc_a accordingly, and then set mc_a's visibility to true.
The inner container method presumes you might have some other content in mc_a that you would not want resized. When using the inner container method you might have to adjust the x/y of mc_c as well since it will scale anchored at the top left corner.

Related

Understanding collapsible box layout and sizing

I am working on a Qt-UI with PyQt and found this nice snipped to create a custom collapsible box widget here: How to create collapsible box in PyQt
I have just replaced the internal QScrollArea by a QFrame.
It works perfectly, as long as the content of the layout that is added stays the same.
However, I allow the user to add or remove widgets from that layout dynamically during use. Here I need some help. I am adding a Grid Layout with, say, 3 widgets inside there (initial creation of the box with .setContentLayout) and once the user adds a 4th widget:
the layout is compressed and keeps its original size
all widgets inside are compressed to fit in the newly created one
overall size of the collapsible box is kept constant.
I have played with various options like updateGeometry() on the content_area and all surounding widgets. It seems I don't fully understand what this code does, I am not really familiar with these animations yet. My best guess is, that the animation somehow blocks the update of the height of the collapsible box, causing the layout to be compressed.
I would be really happy for a pointer where to look / what to adjust to get the size of the collapsible box reacting to the size of the containing layout.
Thanks!

Allow user to resize window such that Gtk3 TextView component can't show all text

I'm working on a GTK program in Rust (someone can probably answer this if they don't know Rust, as I can figure out how to translate between different bindings and the native C API) via the gtk-rs bindings for which I want to have a non-editable TextView who's contents are constantly updated in my code. I want the user to be able to resize the TextView to any size, after which my code will re-calculate its contents accordingly. Unfortunately, GTK prevents any resize from taking place that would hide any contents that are current in the TextView. I can't use a ScrolledWindow because I don't want visible scrollbars, and disabling the scrollbars on a ScrolledWindow prevents the resizing behavior that I want. I also tried calling set_size_request to set the size to both 1, 1, and 0, 0 after every text change, but this does not change the behavior at all either — the user still can't properly resize the TextView (by resizing the window).
How can I enable the resizing behavior that I want?
Probably this is not possible. What would be the point of resizing the text view smaller, if the user can never see the text that is outside of the viewport because you don't want scrollbars? That seems like it would confound the user's expectation of how such a component would usually work.
Maybe an approach could be that you pick a certain number of lines to show, make that the size of the viewport, and delete the old contents of the text view that scroll outside of the viewport?

Set Size for Images from Remote URL relative to parent in react native

Within my react native app I have a simple ScrollView with containers which should stretch horizontally to 100% width. Each of these containers should display an image. I receive the image for each container from a web API (but I could send the actual image as byte64 string too if it makes any difference).
Now the problem I have is that the Image component needs me to set the height and width style attributes in order to display the image. I understand the reasoning for that, since the actual dimensions of the image are only available at runtime and it would cause the UI to behave strange when the images are loaded.
However I would like to set the width of the image to 100% of the parent container, eventhough that means that the the containers height will change when each image are loaded.
Any advice on how to solve this issue?
Not sure if I'm completely understanding the scenario you're describing, so this idea may not work. But if you know the width of the container, you can use that to scale the image's height based on the ratio of the container's width to the image's original width.
I've actually answered a recent question about this by providing a component I coded up for a similar purpose:
Auto scale image height with React Native
Hope this helps.
You can do something like
resizemode="stretch"
with this the image will stretch in the whole container irrespective of the size of the image

wxWidget: How do change the size of the parent Sizer according to the size of the children sizers?

this is a question about wxBoxSizer. I am implementing a custom wxWidget like collapsible pane.
The problem is: I have a wxBoxSizer (Sizer1), and I add another wxBoxSizer (Sizer2) as its child. If I change the size of Sizer2, How do I make Sizer1 update it's size, automatically or manually?
I have tried to call Fit() and Layout() on Sizer1 after I call SetSize() on Sizer2, but it doesn't change the size for Sizer1.
Please help, thank you!
Layout in wxWidgets always works from top to bottom and changing the size of a sub-window or sub-sizer will never change the size of the containing window on its own. If you do want this to happen, call Fit() on the parent window to tell it that should become as big as required by its children. Notice that calling it on the panel will still not be enough, you need to do it on the top level wxFrame or wxDialog itself, unless you have some free space in it which can be used to accommodate the increasing panel size.
wxBoxSizer1 already occupies the whole panel. So unless you change the size of the panel itself, the wxBoxSizer1 wont be resized. You might want to try another size as your main sizer such as wxFlexGridSizer. Here you have more choices for precise control.

Add a scrollbar to yfiles.canvas.Control

I have a yfiles.canvas.Control, with some nodes inside. However, the number of nodes is getting bigger, and I need to add a scrollbar in order to vertically navigate through them, despite the reduced size in height.
How can I do this? I see that a ScrollBar class exists, but I don't know how to integrate it.
yFiles for HTML comes with scrollbars built in. You can customize their visibility, but by default they will be shown as soon as the content rectangle is larger than the visible area. Maybe calling updateContentRect is all that is missing in your code?