ActionScript 3.0 :: How To Retrieve Image Size Dimensions
Jun 21, 2010
I'm using FileReference to load up JPG or PNG images and I'd like to retrieve the image size dimensions somehow. Is there a way to do this?
Code:
//initialize the fileReference
fileReference = new FileReference();
//add some listeners
fileReference.addEventListener(Event.SELECT, onSelectFile);
fileReference.addEventListener(Event.COMPLETE, onCompleteFile);
[Code] .....
View 4 Replies
Similar Posts:
Jan 16, 2011
I'm loading images from an XML file and I know what the image name is, however this is in a string variable. How can I get the dimensions of the image from this?
View 1 Replies
Jan 16, 2011
I'm loading images from an XML file and I know what the image name is, however this is in a string variable. How can I get the dimensions of the image from this?
View 1 Replies
Mar 16, 2010
how to get the dimensions of my stage (x,y), BUT only the stage and not all the objects that might continue off the stage included.For example : My stage is 400 x 550.I want to get 400 and 550 returned.
View 3 Replies
Mar 23, 2011
For an e-learning presentation, what is the standard size the Flash stage should be set to nowadays? Is there a trend as to a specific standard size that everyone is using? This will be embedded / placed / inserted within a .ASP page.If standard interactive actionScript and animations, should I stick with SWF file format?
View 2 Replies
Dec 2, 2009
I've been given a Flash file (.swf extension) to put into a web page. Opening the file in my browser makes it quite blurry, so I'm assuming there is a natural size for the file, same as an image.
It's also rectangular so I need to work out the aspect ratio if I don't have an exact size. How would I find this information out?
View 1 Replies
Dec 2, 2009
i have a flash site im working on, with an image gallery. the way the site is designed, when you enter into a gallery, while it's loading the images (lets say 5-10 images), it draws 5-10 gray boxes in the exact spots the images will load into.
the trick is i need to know in advance how big the gray boxes should be (width/height) before the image is fully downloaded.
i found this site: [URL]
but the way he wrote this, as soon as the class determines the images dimensions, it cancels the download.
i'd rather have a fully complete image class that downloads images, dispatches events with the image dimensions as SOON as theyre detected, and fully downloads the images as well.
View 1 Replies
May 15, 2009
I am loading the SWF just fine, but I want the SWF to fit the root stage exactly. What happens instead is that the external SWF seems to include white space from around itself.
For example, the author-set width of the Tanks game (an example file I was using) is 550px, but when I set the width of loadEvent.currentTarget.content.width to 550px, the game is resized to maybe 350px width. I have to set the value of loadEvent.currentTarget.content.width to something like 640 in order to get the game itself to make full use of those 550 pixels.
Code:
package {
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
[Code].....
I have CS4 with AS3. I hard-coded values for cWidth and cHeight instead of getting them from flashvars because I am just testing in the IDE right now. Normally I would get those vars from flashvars.
View 1 Replies
Sep 2, 2010
I have a generalized media player web app that I wish to be able to use flash in. The client uploads the flash to a particular directory, and a webpage is produced automatically that houses that flash file. The output of this process currently looks something like this:
<OBJECT id="flashContent" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<PARAM value="always" name="allowScriptAccess" />
<PARAM value="#FFFFFF" name="bgcolor" />
[Code]......
I am trying to get the flash to display using the original canvas size (540 x 400 by default) but every time I load this in chrome I get 300 x 150 and in IE the box is square.
how to get it to render using the flash canvas size?
View 2 Replies
Mar 13, 2012
I am getting a mysterious result when trying to load profile images from a logged in Facebook user's friends list into an as3 canvas app. In pretty much every (non-facebook) application I've made where loading an image is required I use the following:
private function loadPic():void
{
var url:String = Facebook.getImageUrl(_friendslistObjectArray[_loadCount].id);
_picLoader = new Loader();[code]............
I can't retrieve the image from the event object,and I am given no error at all.It all just fails silently.If I remove the line var image = evt.target.content, the process runs through the whole array.I can't think of any reason this would occur. Furthermore, if I look in firebug's net activity, I see I see the images get loaded as long as I do not have the line I just mentioned included. I just can't seem to get the image data from the event object to add it to stage or a container movieclip.
View 1 Replies
Feb 25, 2009
how to retrieve information about size (in pixels) of loaded FLV file? Video object returns 2 pairs of parameters (width,height) which are useless because returns always parameters passed in constructor of Video() object. Another pair is (videoWidth,videoHeight) which is always (0,0). I gave up...
I need this information to scale proportionally video clip to size of area designed to display this video.
View 3 Replies
Feb 15, 2011
I have one that's almost done and the stage size is 700x800 px. But I'm starting to worry if that's going to look too small? To change it, will be a lot of work - there's animation, imported Jpegs etc. As far as I can tell, in order for it to look correct in larger dimensions I will need to basically create it again from the ground up. So, I'd really like to get an idea of what the optimal pixel dimensions would be for ecards to run on multiple platforms.
I really want to do this and I don't feel like I can move ahead until I get the viewing size correct. I don't even mind redoing the card. I just want my future cards to be the correct size. I don't want to have to come back and redo them all. By the way, the cards are being made in Flash. The site itself will be created in DreamWeaver.
View 8 Replies
Oct 28, 2009
I'm making an application that gets images from a web site and displays them on a screen for the user.How do I call getSize() on that data? I've been told I can use XML functionality in AS3 to achieve this as well, any idea how someone might accomplish the task?
View 1 Replies
Mar 13, 2009
I want to load an external jpg,Is it possible to get the dimensions of the file loaded after? It seems straight forward enough and easy to do - but I don't ever remember seeing such a functionality in Flash before.
View 4 Replies
Jul 24, 2010
I need to get the width and height of the image before it finishes loading with a moviecliploader instance. This is for placement of another clip, which will always load before the image. Is there any way of doing this??? onLoadStart does not give dimensions of the image.
how do I access a button within the emptymcholder, and place it at a specific position?? Is this possible??
I tried doing emptymcholder.buttonname._x, but it does not work.
View 6 Replies
Jan 22, 2011
I'm using the following code to load images into a gallery through xml. The native resolution of the files is relatively high (though fits well on my 1920 x 1200 pixel display). Since I can't determine the resolution of other users' displays I would like to be able to resize the images loaded so that they fit proportionally on any screen.
[Code]...
View 9 Replies
Oct 11, 2011
I am trying to get the image dimensions to center in the dynamic sprite object but I am getting 0 in the height and widh property. get the image dimensions? I tried by using various properties of image control but I am getting the dimensions. Please see code below and the values in the inline comments
[Code]....
View 1 Replies
Aug 19, 2011
I have been searching in forums and I couldn't find an answer so I thought maybe I should ask.
I wrote a script that allows user to select a local file, which gets resized if it exceeds the width/height limits I specified, and finally this file gets uploaded to the server.
In documentation it writes the same max sizes for BitmapData and Loader:
Quote:
In AIR 1.5 and Flash Player 10, the maximum size for a loaded image is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a loaded image is 8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels in height and 2,880 pixels in width.
So what I need is to check the file size (width and height) before I attempt to load the bytes of the file into a loader. I'm limited to the ByteArray that I get by the load of the file via a FileReference instance.
Has anybody seen a source where you can get that data out of a ByteArray prior to loading it into a DisplayObject?
View 1 Replies
Jul 15, 2004
how to get the width and height properties of an image being dynamically imported into flash? (I need to know this BEFORE the whole image loads)
View 3 Replies
Mar 24, 2009
I'm loading an image into a movie clip dynamically, but I need to know its width. I can get it during the call back function for the complete event but how to I access this variable later on? If I trace its host mc's width outside of that function it returns '0' for the width.
View 10 Replies
Apr 11, 2011
How do I set the width and height of a loaded image in Flash? Setting the dimensions immediately after requesting it does not work. The width and height remain zero.[code]If I wait a short moment and then set the dimensions, it will work.I tried listening for the Event.INIT event and Event.COMPLETE events before resizing as suggested by some tutorials. Neither of the events were triggered.[code]
View 3 Replies
Jan 13, 2010
I have a site that allows a user to upload an image, modify the image, and then save the image to their computer. This works fine, or at least it suits me so far. This is done by uploading an image to an empty movie clip, failcont_mc, and then exporting it as a jpeg once the user is done editing the image. The empty movie clip seems to be dimensionless, which isn't a problem.
The problem lies when the user uploads a photo that has very high dimensions. I'd like to be able to upload the image, then scale it down and keep it's aspect ratio if it's too large. I only want to be able to do this if the image is too large. For example, load an image sized at 800x600 and scale it down to fit into an area that is 500x400 while keeping it's proportions in tact.
Here is an idea of what I want in steps:
1. Upload the image into empty movieclip
2. Check dimensions of the occupied movieclip (previously empty)
3. if the dimensions are above 500x400
4. then scale the movieclip down while keeping proportions in tact
5. display movieclip
The code is made up of snippets from here and there on the internet, so don't be surprised if you see something that looks familiar. On a side note, I'd like to give credit to those who have allowed their code to be used openly. All of the code works fine, I would just like to add steps 2, 3, and 4.
Imageholder: failcont_mc
In the code, I have a big white space to give an idea of where I'd like to place the code. I assume the code is executed as it is read by the flashplayer. What I have tried so far was grabbing the width and height of the "occupied" movieclip and setting them as variables. I used these variables to determine if the width or height was the larger number. Then I used the variables to make a proportion to make sure the end dimensions of the movieclip stayed within the area.
Code:
//Allow this domain
System.security.allowDomain("http://localhost/");
import flash.net.FileReference;
// The listener object listens for FileReference events.
var listener:Object = new Object();
[Code] .....
View 6 Replies
Feb 18, 2010
I am loading images into a movieClip via XML file. I was wondering if there is a way to find out the height and width of the image I am loading. I tried grabbing the movieClip's dimensions but it's only the original size of the clip before i loaded the image.
View 1 Replies
Apr 9, 2007
Is there a way to get the height and width of an image that was loaded via an xml file? I am making an Image Viewer and I want the display to resize to the dimensions of the image loaded.
View 1 Replies
Jun 12, 2008
Here is the pseudo-code to give you an idea what I want:
for (i == 0; i <= 100; i++) {
tempImg = get url ("http://mysite.com/" + i + ".jpg");
while (tempImg != fully loaded) {
[Code]....
Basically, I want it to go through my site from 001.jpg to 100.jpg, and return all the pictures that are not 400 x 320, but I don't know exactly how to code it.
The application doesn't need to display the images on-screen or anything fancy. Simple tracing will do for now.
View 2 Replies
Aug 21, 2003
I am trying to load an image from an external source and then get the _x _y _height and _width of the movieclip that I have loaded the image into.
I have successfully loaded the image into a movie clip but because of the way Flash works I can not pull up the attributes of the movieclip.
View 10 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
May 5, 2011
I basically have a form asking for dimensions of an item and I would like to highlight the dimension in an image that corresponds to the TextInput that the cursor is currently in. What Event to use?
View 1 Replies
Dec 10, 2011
I want to display an image, and it should be transformed like this:If for example, my original image is 200x300 pixels in size, I want it to have a width of 150, and then scale the height accordingly. Then I want to crop the image, so that the result has a dimension of 150x150 pixels.
View 2 Replies