ActionScript 3.0 :: Make Any Size Of DisplayObject Fit A Thumbnail Container?
Jul 8, 2010
I am going to have a situation where i have all sorts of different sizes of graphical data coming at me from XML. The only thing that all of these assets have in common is that they will be sharing a 100px by 100px thumbnail and they are SWFs.My question is, how can i make an object fit into the thumbnail so that:1) Theres no cropping of the item2) Items smaller than 100x100 must be enlarged3) Items larger than 100x100 must be shrunk
I'm trying to create a Flex application that can automatically shrink based on the size of the components that it contains, so that a user can shrink it to a minimal view to see more of the HTML page it's embedded in.
I know how to change the size of the whole application using ExternalInterface, but I'm having trouble automatically figuring out how much the size changed when something is hidden or shown.
How can I hide one of the text fields and cause the VBox to shrink? I'm currently setting it to visible = false, but that doesn't seem to affect the parent VBox.
Once the VBox shrinks, how can I detect that the Application no longer needs so much space, and then go about figuring out how much less space it needs?
I've tried using ResizeEvent, but I haven't been able to get them to work, but I could be doing something wrong.
In a project, I need to pass in a DisplayObject to a container in a specified frame of a MovieClip. (for example a "container" instance at Frame 15)
I thought it should be just okay with this code:
Code:trace(mc.currentFrame);// Output 1 - we are at the first frame of this mc.
[Code]...
If the timer delay is set to 1, the container is still not available, but if it's set to 100, it's okay. Then I make this delay bigger and bigger, the threshold value is 25. (My FPS is 30)
I'm having trouble trying to get rid of an image in my container when I click on a thumbnail. I keep getting an error saying DisplayObject must be a child of the caller.I've looked around the web and can't figure out what I'm doing wrong, nor am I sure what the error means when its referencing the caller.[code]
I'm coding this minigame implementation where a sprite traverses tiles on a screen, and when he's done traversing a tile, the tile "disappears" (its alpha decreases and it becomes a "wall" the player can not move onto). Now, simple enough. Make use of a traversing and traversed boolean arrays to store if a tile is currently being traversed, or if it isn't, but it has been traversed. So, if traversing == 0 and traversed == 1, make the tile "disappear". However, and here's the weird part, if I just set the alpha to, say, 0.5 in this if statement, it sets the alpha on just the tile I traversed, whereas if I try to make it part of the wall as well (in the same if), every tile except the one I've traversed to becomes a wall.
Here's part of the code (it happens in the enterFrame game loop):
Code: const NUM_TILES = 15; //Add MC for all the tiles var tiles = new MovieClip(); addChildAt(tiles,5);
I found this quite amazing website [URL] and If you see the website when you zoom out there is no animation neither interaction with the content of each container, I mean, if you see the first one, the home container there is a animated banner, however when you zoom out that banner stops. Also, you if see, every time you zoom in a container it loads its content, if you zoom out and zoom in again it loads again the same content...this is cool because you're not wasting too much memory and you're not creating a huge .swf file.. Are they generating some kind of bitmap thumbnail for each container everytime we zoom out or what?
The following is entirely a math question. As we know, PerspectiveProjection delivers perspective transformations in 3D represented by the interdependent values of fieldOfView and focalLength according to the following formula:
Q: How to get the visible on-screen size of the DisplayObject (Cube on the above-linked image) to which PerspectiveProjection has been applied? A more thorough description and illustrative code on the issue in ActionScript 3 lacks functionality for visible bounds of DisplayObject.
function createThumbs() { _myThumbData = new BitmapData(photodefault.width,photodefault.height,false,0xffffff); photothumbs.t1.addChild(createBitmap(_myThumbData)); function createBitmap(bmd:BitmapData):Bitmap
I use kirupa's xml gallery with thumbnails. I'm trying to do something but couldn't manage yet.What i am trying to do is different widths for thumbnails. I managed to do thumbnails with different widths(same height) but the order of them doesn't match with the xml order. here is my code.
I'm tring to have it when you click on a thumbnail, it loads a larger image over the scene. Here is an example, since I'm sure that my desc. is awlful. link My scrolling thumbnails are based off of the tutorial on kirupa.com. Here is my site. and action script. (architecture is only one that has any images on it currently for testing)
Code:
cliparray = []; function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild;
I'm working on one current project, I don't have any issues to load a SWF into a main SWF but I can't figure out how to apply dynamically the scale down and up into a thumbnail images size while using the Resize event handler to fit in any browsers sizes.
I load SWF into a Loader object then add it into a container => currentMC. I want to size it and keep all the pieces inside this container. Therefore no matter browser size, I just want to be able to apply scale on it to fit it.
Does anyone know how to do that? How would I deal with stageWidth and stageHeight?
Based on the Photo Gallery using XML and Flash tutorial found here:I�m having trouble with loading thumbnail images of various sizes which overlap if they are smaller than the previous image.The specific line that causes this is target_mc._x = hit_left._x+(target_mc._width+5)*k;I�ve tried all sorts of things with the closest being the following which put the images in the right size, but with the omission of �k� their order is backwardstarget_mc._x = (thumbnail_mc._width+5);Here is the full function block as per the tutorial
how to measure the actual size of the container just like the Flex components. I wanna create some containers with my own layout arithmatic, so I must know the size of every child, but sometimes I don't know what's the size which DisplayObject or DisplayObjectContainer that I will add to the container actually is, how can I do?
I wanna know if exist a class in AS3 that allow to intercept the window size of the program in wich sfw is executed. For example the browser window size
Is there a way to have the full stroke size (height/width) fully included or excluded in the movieclip symbol?If I'm making a rectangle with size 100, adding dynamically lines of size 20 when certain criteria are reached in game. But I also want to have stroke of size 5-6, problem is that they half their size in included in the rectangle 100 of height, and half are outside.It makes it more tricky to make the formulas to take in consideration the 2.5 for the size and also the effect on x positionning etc. Much easier to just have to do the like of "x += 20" without the assle of calculating the half stroke height.So how to have those stroke included/excluded when converting to symbol?
Really not enjoying myself with AS3 - it's about as userfriendly as an airplane cockpit. I'm sure Flash the program is quite happy with it, but spending hours into weeks trying to implement pretty ordinary functionality is getting really tiring.
I have a textfield loading in html/CSS file. The textfield is in a container mc. I'm trying to use a scrollbar on the textfield, and I need to set the textfield to newsText.autoSize = "left";. When I do this, the textfield displays the entire contents of the html file in the swf, ignoring the textfield size AND the mc size, displaying all the lines in the file in howover many lines are in the html file.
I'm autocenting my swf in the browser, so this of course throws the whole thing off center.
How do I get the size of the content area of Container objects? One non generic solution is checking for styles I suppose but I am looking for some code that works generic for all standard flex Container objects. The controls are Flex 3
I have a video object that dynamically changes. I want to put that inside of a movieclip that is always 320,240 no matter what the video object size is. I want the video object to increase or decrease but I always want to display it at 320,240. How would I write this? I tried:
But the video object still is large (my video object is 480,360 in this case). It seems like it is not nested inside of the the videoDisplay sprite which should only be 320,240.
I would like to know how to make flash size (width and height) full size in the browser? the real size of flash is w:955px h:600px I tried to make w:100% and h:100%, it makes pictures pixelate.
How can I limit the size of a child container with percentage width/height of 100%?
Example:
<mx:HBox id="container" width="100%" height="100%"> <mx:HBox id="scrollContainer" width="100%" height="100%"> <!-- keep this content limited to the size of "container" -->
[Code]....
Apparently I can get the desired behavior if I change HBox to Canvas but I would still like to know how to accomplish this with a HBox and why it differs from Canvas.
S there any way filters applied to a DisplayObject (drop shadow, glow, bevel) can scale relatively with the parent (the DisplayObject it is inside)?And what about other properties like .distance for drop shadow?For example... If I have a 100px rectangle with a 10px glow inside a container object, and I set scaleX/scaleY of the container to .1, I want the glow to inherit the scale change from the parent (1/10th the size) just as the display object does that the filter is applied to.Instead, if you try this, you will see the glow stays at 10px no matter what scale the filter target or the container is transformed by.Pseudocode example (steps to reproduce),
1) create a sprite called _myOuterSprite on stage at scaleX = scaleY = 1
2) create a sprite called _myInnerSprite inside _myOuterSprite at scaleX = scaleY = 1
3) draw 100px rectangle into _myInnerSprite
4) apply 10px glow to _myInnerSprite
5) transform scale of _myOuterSprite to .1
Result:
- child sprite (rectangle) scales to 1/10th the size
- glow stays the same size
How can I make it so that glow scales to 1/10th as well?
...without capturing and scaling bitmap data
...without losing interactivity on objects
...in a way that would work visually for every filter, not just glow (drop shadow has distance property too, etc)
I have to make thumbnails from banners in swf file format (flash 9). I want to use php, but if that's not possible anything which work in a linux command line is fine by me.
I tried to open them with ffmpeg-php, but it says: Can't open movie file /where/the/file/is
(i'm using flashdevelop / flex sdk)IS there any way filters applied to a DisplayObject (drop shadow, glow, bevel) can scale relatively with the parent (the DisplayObject it is inside)?And what about other properties like .distance for drop shadow?
For example... If I have a 100px rectangle with a 10px glow inside a container object, and I set scaleX/scaleY of the container to .1, I want the glow to inherit the scale change from the parent (1/10th the size) just as the display object does that the filter is applied to.Instead, if you try this, you will see the glow stays at 10px no matter what scale the filter target or the container is transformed by.Pseudocode example (steps to reproduce),
1) create a sprite called _myOuterSprite on stage at scaleX = scaleY = 1
2) create a sprite called _myInnerSprite inside _myOuterSprite at scaleX = scaleY = 1
3) draw 100px rectangle into _myInnerSprite
4) apply 10px glow to _myInnerSprite
5) transform scale of _myOuterSprite to .1
Result:
- child sprite (rectangle) scales to 1/10th the size
- glow stays the same size
How can I make it so that glow scales to 1/10th as well?...without capturing and scaling bitmap data ...without losing interactivity on objects...in a way that would work visually for every filter, not just glow (drop shadow has distance property too, etc)
I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.
I have just done the tutorial for the scrolling thunbnail panel but now I wish to make it continous is this easily done? I saw the xml perpetual scrolling thunbnail post in the forum, is this the same thing?