ActionScript 3.0 :: Any Method To Get The Dimensions Of What Is Displayed In A Display Object?
May 13, 2011
Is there any way to get width/height of a loaded movie, excluding any area that is not displayed? My problem is that I am loading swfs to use as icons in a menu and am unable to get the desired width & height in order to calculate dynamic spacing based on how large the icons are. Most of the swfs where published with a document size of say 50 pixels x 50 pixels but some vary in dimensions. When I access the width or height property of the swf, I get a value that includes objects in the swf that fall out of bounds of the size set in the fla. Basically I get values that include areas that are effectively masked. So my 50x50 icon (that displays just fine), gets me a width of 63x86 or something like that. My sloppy workaround that I would like to replace was that I republished all of them with a extra property that I can read when I load them instead of using the width and height.
View 1 Replies
Similar Posts:
Dec 20, 2010
I'm having troubles getting the dimensions I'm looking for for a given display object. This display object has some transparent area to the top-left of the opaque content but to the bottom-right of 0,0. As such, the display object's reported width ONLY includes the opaque area, not the transparent area. For example:
Code:
var myChild:Sprite = new Sprite();
myChild.graphics.beginFill(0xff0000);
myChild.graphics.drawRect(100, 100, 100, 100);
myChild.graphics.endFill();
trace(myChild.width);
This reports 100 as the width and height. I need to somehow retrieve 200 as the width and height.
I'm trying to take a bitmapdata snapshot of the display object, but when I do new BitmapData(myChild.width, myChild.height) and then draw into it I don't get the full opaque content of myChild drawn because the dimensions are too small.
View 3 Replies
Apr 14, 2010
I was working through the example AS code in Adobe's documentation[url]..
Usually, when working with video, I use the FLVPlaybackComponent, but for this project I don't really need any fancy skins/features, I just need to load and play an external video.
Anyway, I have a .MP4 video that when I right-click and look at its properties... its dimension is 640x480.However, when I try and test the [code]...
View 4 Replies
Nov 18, 2010
What are the maximum dimensions of a bitmap allowed to be loaded and displayed in Flash?
View 1 Replies
Jan 31, 2010
If I create a rectangle with 100px width and 100px height and then rotate it, the size of the element's "box" will have increased.With 45 rotation, the size becomes about 143x143 (from 100x100).Doing sometimes like cos(angleRad) * currentWidth seems to work for 45 rotation, but for other bigger angles it doesn't.At the moment I am doing this:
var currentRotation = object.rotation;
object.rotation = 0;
var normalizedWidth = object.width;
[code].....
View 4 Replies
Aug 30, 2005
I recently wrote a small script to display an endless scroll for 360 degree images. The image is loaded dinamically so I can use it as a viewer for all the 360 degree images in the site's gallery. It works fine, but I found one image that appears truncated even though everything else works as expected. I found this [URL] that says: The maximum image size of a Flash 2 movie is 2880 x 2880 pixels The image that is giving me this problem is larger than that and it seems to be cut at 2880px widht. Can anyone confirm this? And if so, is there any way to override it since I'm using pure as? Despite the years working with flash, I keep finding these nasty surprises. Last time I learned about the 16,000 frame limit when working on a cd presentation... I wonder what's next.
View 2 Replies
May 31, 2011
I transformed a sprite with a simple rotationX and I would like to get the projected dimensions of the latter, i.e. the dimensions as they appear on the stage (see picture here : i.imgur.com/7Ugrv.png)The sprite is not in the middle of the stage, so a simple Math.cos doesn't work.Is there any ActionScript method or math function to get the dimensions ?
View 4 Replies
Apr 28, 2009
How does that work? How come when I use "addChild(l);" (l being my Loader object), the SWF has already played to it's first stop point?How do I prevent that? It actually throws an error because of it.
View 4 Replies
Jun 25, 2009
I am new to Flash and ActionScript 3.0 environment. I have only basical knowledge regarding this platform.
My issue/problem starts here:
I have a Sprite object on the stage.
What I should do in order to change the dimensions (viz.,size,colour, or both ,etc) of this Sprite object, when it gets clicked?[code]...
View 2 Replies
Jun 25, 2009
I have a Sprite object on the stage. What I should do in order to change the dimensions (viz.,size,colour, or both ,etc) of this Sprite object, when it gets clicked?My sample code looks like this:
Code:
var circle:Sprite = new Sprite();
stage.addEventListener(MouseEvent.CLICK,onStage);
function onStage(e:MouseEvent):void
{
[code]....
View 5 Replies
Apr 7, 2011
I am looking to determine the final event or location where it could be determined that an Image, or a UIComponent, has been rendered to the user. I need to know when it has been displayed and thus is, presuming it's not covered up or at a silly location, visible to the user. In the UpdateComplete Event Documentation it says:
This is the last opportunity to alter the component before it is displayed. All properties have been committed and the component has been measured and layed out.Overriding the dispatchEvent on an Image shows that the UpdateComplete Event is the last one that it dispatches after an update of the .source property. Breakpointing and walking the code after that event shows that the LayoutManager seems to finish with it's actions before the Image is displayed.
I have watched the dispatchEvent on and updateDisplayList on the canvas container and no dice. I assume that there is some higher (lower) object that I might be able to extend or listen to that would give me that final piece of information.
NoisyImageTest.mxml - test application for watching the event loop. If you breakpoint at line 22 you see the last updateComplete event but the image is not yet displayed. Stepping through the code from there, it exits the thread after the LayoutManager but still has not updated the screen. I assume that there is a point where the systemManager or stage or some other item could say it drew the image.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:local="*">
<s:layout>
[code]....
View 1 Replies
Jan 25, 2010
In AS3, I have a Sprite that has a Z axis rotation applied.How do I calculate that Sprite's dimensions (it's original size) from Sprite.rotationZ and Sprite.getRect(...)?
View 2 Replies
Jan 31, 2012
What do I have to write to keep the movieclip not to change dimensions if the user starts playing with the dimensions of his screen ? I remember it was a line of as3 written at the beginning.
View 3 Replies
Mar 2, 2012
How do you access every displayed object of a certain kind at once? Here's the code.
[Code]...
I want to replace the underlined part so that it refers to every instance of the dirt symbol without an insane number of iterations. From that, I plan to make the player capable of standing on each dirt symbol as they are being created, as well as move all of the dirt symbols with ease.
View 2 Replies
Jan 7, 2011
Can I use actionscript to change the size of a displayed object based on 2 objects proximity?
As in the closer 2 objects get, the bigger another one gets?
View 1 Replies
Mar 6, 2008
Is there any way to test if a display object has been added to the display list?
View 9 Replies
Jan 22, 2012
can I resize a display object (container) without its contents (children) are resized?
For example, in the following code when I resize the green square, red is also resized. I wanted to resize only the green.
ActionScript Code:
import flash.display.Sprite;
var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0xff0000);
[Code].....
View 3 Replies
Mar 4, 2011
What's a simple way to detect if a display object is currently on the display list?
View 1 Replies
Feb 27, 2012
I am not sure if I worded the question correctly, however, I have code to detail it. Firstly, I have a class Class1:
[Code]...
View 1 Replies
Aug 14, 2009
Can you make one Bitmap Object (I'm using an external jpg) or something similar, and then display it many times simultaneously without creating a separate object each time?
Also, would they be easily removed or hidden?
I've got a little checkmark jpg graphic loaded here, but I'm not sure how to go about using it in many places at once.. I can only display it in the one place at any one time...
I'm thinking there might be a way to load the picture once, then use its bitmapData elsewhere in new display objects somehow, without needing to reload the image over and over?
View 3 Replies
Feb 9, 2009
It's my understanding that a display object cannot be in the display list more that once.So if I add something to the stage shouldn't a second addition of the same object replace the first? for instance:
[code]...
there should now only be one "myDisplayObject" on the stage.
View 3 Replies
Jun 27, 2011
How can i cast a object to another type? in AS3 i tried putting (objectType) infront of the variable but it doesnt work, below i have added objects of fishes into the child, and i am getting the fishes back out when mouse down is triggered, and then calling the fishes what to do. however i cant call the method of the custom class fish because it is a displayobject.[code]...
View 1 Replies
May 31, 2009
I have problem with accessing object created by function imported from another package.
I have 2 packages DragDrop and UserInterface. In UserInterface I create methods for buttons and later add them in DragDrop . I make it in two different ways:
One(this one works):
[Code]....
View 6 Replies
Oct 31, 2010
I typed this into my adobe flash ide
PHP Code:
var bitmapData:BitmapData = new BitmapData(100,100);
var bitmap:Bitmap = new Bitmap(bitmapData);
super.addchild(bitmap);
and compile it, the error pop up like the above (in the title) ReferenceError: Error #1070: Method addchild not found on flash.display.MovieClip I don't understand, could someone point out what is the error in my code?
View 2 Replies
Sep 22, 2009
i am using the script:imagesb_btn.setSize(width, height);imagesb_btn.setSize(100, 50);but i keep getting the above error message when i try to publish.As far as i am aware im using as3 script in an as3 movie.
View 4 Replies
Mar 18, 2004
I am trying to implement an onEnterFrame method within an object that is not applied to a MovieClip. The onEnterFrame is not running, most likely because it is not a movieClip. Is there a way of making it run without attaching anything to the stage?
View 2 Replies
Mar 18, 2004
I am trying to implement an onEnterFrame method within an object that is not applied to a MovieClip. The onEnterFrame is not running, most likely because it is not a movieClip. Is there a way of making it run without attaching anything to the stage?
View 2 Replies
Aug 31, 2002
How do I create a method in an object,
[Code]....
View 3 Replies
Feb 27, 2010
[code]Is my code and when adding the backtostart function i always get the error if i remove the back and backtostart parts of the code it runs fine any help?
View 1 Replies
Nov 19, 2009
Is there method that gets called just before object destroyed? So I can override it.
Like
protected override function beforeDestuction():void
{
trace("This object is about to be destroyed!");
}
View 4 Replies