ActionScript 3.0 :: Determine Size Of A MovieClip?
Mar 24, 2009I have a swf file that is 7367KB. I would like to reduce the size of the file. How do I go about figuiring out the respective sizes of my movieclips?
View 2 RepliesI have a swf file that is 7367KB. I would like to reduce the size of the file. How do I go about figuiring out the respective sizes of my movieclips?
View 2 RepliesI have a list of fonts obtained via Font.enumerateFonts() and I want to display them all as 12 pixels tall. The problem is that I cannot simply set the point size because this can vary in actual pixel size for each font. So basically I want to determine what the correct point size is for a font in order to make it exactly 12 pixels tall. Because I'm doing this with a potentially large list I'm looking for an efficient method to do this.
View 1 RepliesIn Java, what is the best way to determine the size of an object?
In Actionscript I can usually just do:
var myVar:uint = 5;
getSize(myVar)
//outputs 4 bytes
How do I do this in Java?
Is there a way to take a compiled SWF file and figure out how much of it's size is used by code and how much is assets (images, etc)? I'd like to see if I can get my Flex SWF smaller but I'm unsure what's taking up the most space.
View 1 RepliesIn general, I haven't yet found a definitive way to get Flex and Spark containers to size themselves relative to their children. I have searched for good documentation for this concept many times but have yet to find anything that sufficiently explains the concepts. A simple example of something I often want to do is to draw a border uniformly around a set of controls. The goal here would be to have all UI elements to size themselves automatically.
<s:BorderContainer>
<s:HGroup>
<s:Label text="l1" />
<s:Label text="very long label 2" />
</s:HGroup>
</s:BorderContainer>
I would want the Labels to size themselves based on the text property, and the HGroup should be as big as needed to contain labels and BorderContainer should only just contain that HGroup. Now the more complicated example that I am working on now. I have a class that extends the BorderContainer. Within the class I create an HGroup with 5 Labels as children of the HGroup. Then the HGroup is added as a child of the ExtendedBorderContainer (using addElement() method).
Then the new class is used in the application as:
<mx:ViewStack>
<s:NavigatorContent>
<my:ExtendedBorderContainer />
</s:NavigatorContent>
<!-- more NavigatorContents here -->
</mx:ViewStack>
I have tried various [max|min]height/width combinations and I can not get the desired layout, which is very tight borders around elements without extraneous space starting from the deepest Label children all the way up to the NavigatorContent.
Is there any AS to determine the size of the fullscreen playback? Usually I use;
fscommand("fullscreen", "true");
fscommand("allowscale", "true");
But I would like it play back at a particular size like 800 x 600 so the rest of the screen is just a border of the documents colour. Can this AS be adapted to do what I need?
Each system - whether it is win, mac, or linux - displays (desktop) icons at a
user selected size (e.g., 16x16, 32x32, 48x48, etc.)How can I find which size is being used by the local system from within Flex or ActionScript3?
I have movieClip (in as3) and I'd like to know is this movieClip playing now
View 2 RepliesI am trying to create a scenario where I can have two or more movie clips interact with each other to determine the distance between themselves. I found a script online where it does two movieclips however I need it to do more than two, possibly up to about a dozen. That is the first part. The second part is that I need to be able to select one movieclip and for it to become the "master" and then the other clip determine there distance from the "master". I hope I am explaining this correctly. I have attached the fla file which has the script in it for two movieclips, and then I have modified to add the other clips but not sure of the coding to make it work.
View 5 RepliesI have a movieclip with a dynamic text box inside it that gets filled with content from an external source. It scrolls up contstantly and is masked, this works fine. I would like to know how to determine when the movieclip's bottom is beside/parallel to the mask movieclip's top. Basically, I want to find out when one movieclip is beside another.
View 6 RepliesI have some movieclips like this one: game_mc.substage_mc.rightHand and inside the rightHand i have a thread_mc like this:
game_mc.substage_mc.rightHand.thread_mc
Ok so here is the thing, i need to access the thread.x and thread.y position related to the stage or substage_mc i donīt really care, but if i do this[code]...
Okay this is always something that's puzzled me. If I create a movieclip, place that clip on the stage, then inside that movieclip, create another movieclip, how does flash determine the coordinates of that second movieclip in relation to the stage. The reason I am asking this, is that I have a large movieclip which contains a number of other smaller movieclips. When a user clicks on one of the smaller movie clips, I need the larger movieclip to move so that the clicked movieclip is now centered on the stage.
I figure that this would be easier to know if I knew how to calculate the distance which the second, smaller movieclip is from the center of the main stage in x and y coordinate values. Am I making any sense? If not I'll try to explain again.
This is the third thread I've written for my current project (1st was answered perfectly, 2nd failed [but I still figured it out anyways]) but I'm not sure if there is a solution to this problem. I can't really explain my problem, so once again I've included a helpful animation to show you what I mean. Bear in mind that the pale-blue box represents the movie clip's borders, and those borders are usually changed to include the animation (instead of the borders moving with the animation, the borders get bigger).
For the animation problem, I've already got a solution: create an invisible movie clip that has the exact size and shape of the animated movie clip and make it follow the movie clip as it animates, and make the hitTest check the invisible movie clip instead of the animated one. As for the rotation problem, well, I don't know how to fix it. Is there a way to change that?
I have a MovieClip with an image in it that is designed to animate and move in a certain direction depending on which way the MC is "facing." To that extent, yes, there is a "front" to the MC.
However, I am at a loss for how to determine which way it is facing. Use of scaleX does not work as if I innately put the MC in my work area before the coding and flip it, scaleX will always be 1. Attempting to throw in a hidden MC within that MC and determining if its X value is greater or less than zero didn't work either, because THAT number will always remain the same.
For some additional info, the MC is designed such that 0,0 is in the BOTTOM left corner, at which point the image within the MC is facing left. Flipping it so 0,0 is in the bottom right makes it face right.
I cannot, in any way, shape or form, use a variable within the MC to say which way it is facing either, as there could be a dozen of this same MC active, only with different instance names, at a time. The only way I could use a variable within the MC is if I could determine which way it was facing anyway, which is exactly what I'm trying to do here.
Okay so I want to add:
if (_root.Gir_mc._x<=595) {
_root.Gir_mc._xscale=80;
_root.Gir_mc._yscale=80;
[Code].....
I have a problem concerning the size of an animated MovieClip.What I want to do is drawing a frame (.graphics.drawRect(...), etc.) around a loaded image file. This works well on loaded images that are static, no matter if it is a jpg, png or a non-animated swf.However, if I load a swf that is animated, its width and height properties are simply wrong. Much too small. They are, however, always the same wrong values for the same animated swf.I also tried with getBounds and getRect on the loaded swf (which I put in as a MovieClip), with the same results.What's up with this and how can I get the real size of the swf?
What we could do would be to insert a fully transparent layer into each swf that would define its size. That would hopefully make the MovieClip always have the correct size. But I would prefer a working way during runtime that workaround works, but I'd still prefer a way that does not involve additional work for our artists (minimal as it might be).
I have movie clip, when I go into the transform panel and change the rotation, the movieclip jumps a size down, then rotates.
View 1 RepliesI have an MovieClip that loads a slideshow (imagerotator to be exact). I'm using AS2 loadMovie to achieve this. The images in the slideshow appear way oversized, extending the width of the entire stage. How to I constrain the size of the slideshow/MovieClip contents?All the images are going to be the same pixel dimensions so it doesn't have to be anything fancy.
View 2 RepliesI have a loop where I load a couple of images and I want to place them in the y-axis on stage, with 20 pixels space between them. To do this I have to know the height of each image, but as you know, I can't get the image height before it completed loading.I really don't want to do one loop for the loading, and another loop for the placing.
Code:
for (var i=0;i<productXml.productCategory.product.length();i++) {
var product_mc:MovieClip = new MovieClip();
var imgLoader:Loader = new Loader();[code].....
I'm making a simple platformer. I have an array holding what my level looks like and my main character is a horse.... okay it's a unicorn... anyways, Whenever I jump to a platform the hittest is saying that he has landed even though his head or his tail is just over the edge... I'm trying to make it so that only his feet will allow him to land.
View 1 RepliesI am building a site where it has a section that when i mouse over it, a new window with more buttons show up, except when i take my mouse out of the area of the Movieclip that contains those extra buttons, that area disappears
View 3 RepliesI'm working on a UI for a set top box that has a linux os, which runs a java virtual machine, which loads a flash (swf) interface!
Im trying to load a jpg into a MovieClip using the loadMovie() command because the MovieClipLoader object was introduced in Flash 7, which the box cannot run. Im preloading the image using getBytesLoaded() and getBytesTotal() and after its loaded I want to stretch it to a certain size. Im having 2 problems:
1)The FIRST time I run the loadMovie command, it doesnt always load the jpg, and getBytesTotal is set to -1. After I load it a second time, the preloader works fine.
2)I cannot use mc_name._width = 1000 to scale the width of the jpg image to a certain width. Ive tried my code on a fresh flash file and it works on a computer using Flash 6, Actionscript 2, but not on the box. Whats weird is that if I use mc_name._xscale instead of mc_name._width, it works.
Here's the code:
Code:
ImgUrl = "http://img143.imageshack.us/img143/6639/1680x1050k.jpg";
_root._container_mc.removeMovieClip();
_root.createEmptyMovieClip("_container_mc",_root.getNextHighestDepth());
[Code].....
I have a movieclip with my video player controls (play, stop, mute, etc). It is 480 pixels by 22 pixels. My video screen is behind it, which is 480x270. The video player controls are bottom-aligned.
I have some actionscript which makes the controls fade in and fade out, according to mouseover.
My problem is the video player controls movieclip is only 22 pixels tall.. so for anyone to see them (remember it requires a mouse over for them to appear), they have to put their mouse right on top of the controls. I want to make it so the video controls movieclip is not 22px tall, but really 270px tall.
So I need something to "hold it up" like a tent... to force it to be 480x270, clear background, with my 480x22 controls at the bottom.
i want to make it so when the movieclip moves (arrow keys) closer to the top it gets smaller and moves slower, and when it gets to the bottom it gets bigger and moves faster.Here is a working code I have, but I need to think of something better.
Actionscript Code:
if (this._y < 700){this._xscale = 120; this._yscale = 120; _level0.speed = 3.6;}if (this._y < 650){ this._xscale = 115; this._yscale = 115 _level0.speed = 3.4;}if (this._y < 600){this._xscale = 110;this._yscale =
[code]....
the only problem with this is that it is by 50's. I figure I would need a formula
how can I do to resize the size of my movieClip and the content of my movieClip(swf, jpg) to the stage?
View 5 RepliesI made a gallery in flash. I have external images load in a fixed display area -- I call it 'imageStage'. When the image is loaded, I resize the movieclip at the _x and _y to make the image fit the stage.
But what happens -- when I flip prev/next through a couple images, they keep shrinking and shrinking. Images that are smaller than the fixed area are being shrunk even further.
I'm thinking maybe if I clear the existing image from the MovieClip, it will reset itself back to regular size and proportions. But I don't know how to go about it.
If a drag a component from the library into a movieclip and then drag the movieclip to the stage. Now if i resize the movieclip, can I set the component with a fixed width or height?
View 1 RepliesI have a movieclip slider_mc that can be dragged across the screen. There are also lots of small movieclips on the stage that I would like to increase and decrease their size depending on how close the draggable movieclip is to them
View 1 RepliesI have a container movieclip that it carries some children of a movieclip .its inner children are moving and therefore our container movieclip will resize to bigger and smaller width and height. but when i scatter then hoarding these children in container ,as trace of main container movieclip size , shows maximum value of dispersal of children and now i want to refresh the size of the container movieclip to resize its currently real size(as children dispersal) and set it as a picture of scroller.?
View 0 RepliesI am creating an empty movieclip and loading a jpeg into it. The mc does not seem to resize to account for the jpeg's size, also the parent mc (thisClip) which is also created dynamically (with attachmovie), is set at 500 why:
thisClip.createEmptyMovieClip("theJpeg", 2);
thisClip.theJpeg.loadMovie(url);
thisClip.theJpeg.onEnterFrame = function(){
[Code]...