Actionscript 3 movie clip size with float - actionscript-3

I'm wondering why flash does not support exact value of box sizing.
When I try to set dimensions of a box with "850.54" of width and "1624.71" of height,
The real box size's set to "850.50" of width and "1624.70" of height by automatically.
I lost my decimal points(float) value in my box.
What happened to me?

Width and height are internally measures in 1/20ths of a pixel, so reading width will return a value that's a multiple of 0.05. The solution is not to use width to store values with precision.

Related

Width/height as auto value forced as percentage?

if i have an element where width and height is sat to auto, can i force it to auto as em / percent in css ?
The reason for this is because pixel decimal values are not respected by the browser and will be rounded up/down.
Any length value, regardless of its specified unit, will resolve to a used value in pixels. Even if you could change the behavior of auto — which you can't — you'd still end up with a pixel used value.
Rounding inconsistencies are an unfortunate consequence of divergent implementations. There is not much you can do about it.
Yes, you can set the width or height of an element to a percentage.
In your CSS it would be:
height: 50%;

How do I space images on a page in a similar way as Google images

Images displayed in goolge images end squarely at the right hand side of the page regardless of image dimensions or screen size. I was thinking that perhaps it is possible to add some sort of dynamic padding to make images fit squarely into a div? If anyone has any suggestions on how to do this it would be greatly appreciated!
Define the height of each row and the minimum and maximum width you want.
Calculate the width of your image if you scale it to the given height.
If the calculated width lies between the minimum and maximum width, scale it to this size.
If the width is smaller, scale the image so it has the minimum width, and crop it so it has the proper height.
If the width is bigger then the maximum, scale it this way and crop it, so it has the right width.
In order to make all the images fit the row perfectly, you might need to adjust the minimum and maximum width. Especially images which need to be cropped anyway can be used to adjust the length of the row.
You can achieve this using CSS (& JavaScript) or by doing it on the server side. If your page width is dynamic, you have to rely on CSS/JavaScript though.

Creating 2-D Pulse in Octave

I want to create a 2-D pulse in Octave. It will consist of
a box in the middle with value 1.0 and 0.0 outside. The size of the 2-D array is 512. How can I do this in Octave?
Given the width and height of this box stored in width and height, and assuming that they are both odd for symmetry, it's very simply:
row_half = floor(height/2);
col_half = floor(width/2);
pul = zeros(512,512);
pul(256-row_half:256+row_half, 256-col_half:256+col_half) = 1;
The first two lines of code determine what half the width and height of the defined box is. Next, we use the middle (256,256) and make sure we span from half the width both left and right, and half the height both top and bottom. This fills up the total area of your box and that is done by the indexing on the fourth line and we set these locations to 1.
The output 2D "pulse" is stored in the variable pul. A pre-condition of the above code is to make sure that your width and height are fully contained within the 512 x 512 grid. If not, Octave will give you an error going out of bounds.
Example
Let's say my width and height were both 101. We get this pulse, if we did imagesc(pul);

Why do my HTML5 rectangles appear zoomed in?

Following http://www.html5canvastutorials.com/tutorials/html5-canvas-rectangles/, I have drawn some rectangles side-by-side on a canvas. The problem is that they appear greatly zoomed in; at a zoom of 1.0 they appear approximately five times their original size; they appear correctly sized (if fuzzy around the borders) at a zoom of around 0.16.
I expect I could get a workaround by making the pixel dimensions of the canvas much greater and zooming out, but what is the proper way to get a 1:1 scaling on a canvas? The canvas is styled to width and height of 100%, and the body has a margin of 0. Manually setting the canvas's width and height to the height and width of the window does not alter this behavior.
TIA,
the problem is, you set the width and height of the style for the canvas. You need to set the width and height attributes, not the css style. so something like:
<canvas id='mycanvas' width='800' height='600'></canvas>
More info in a similar question: Canvas is stretched when using CSS but normal with "width" / "height" properties

Tell me the difference b/w just width and height and (max/min)width and height?

What's the basic difference between [width and height] and max/min[width and height] and where should we use each of them?
Thanks in advance........
The basic difference is that width and height will specify the exact width and height of an object. Max/min width and height will specify the maximum or minimum height and width that an object needs to be.
Say you had a div that you wanted to load images into, but you wanted all images to be the no larger and no smaller then a specific width or height, then using min/max calls would be ideal.
In other cases, where you know the width and height (say for only a specific image) then you do not need max or min height/width calls.
It is also important to note that max/min height and width calls will over-ride height and width calls.
Here is some more information:
CSS Height and Width
CSS Tests - Min and Max
width/height give you the strict constraints. max-height/max-width tell your element to be not wider/higher than a certain value, but the element can still be smaller than that value.
max-height/width are commonly used when you want to make the site behave according to the screen it is viewed on, but to not be super huge on the large screens anyway. The same about the elements - you might want to accept images of any size, but want to make sure they are not breaking your site layout. Hence you use max-width/height.
They don't work in IE6 though. If you need to support min-width/height in IE6 you can use regular width/height. IE6 will treat them as minimum values anyway and will expand them in case content needs more space. Both min/max width/height work fine in IE7+