ActionScript 2.0 :: Centering A Loaded Image?
Jun 24, 2008
i am trying to get an empty movieclip to center after a jpg loads into it. the images load, but they don't center. my first attempt (using loadMovie) would read the size too quickly and would only center after a second click. i thought using a MovieClipLoader would work, but my leftEdge always returns 350. i'm getting a 0 value for _width.
on a related topic, i want to apply a DropShadowFilter to the same empty movieclip.i haven't tried it with the MovieClipLoader, but it didn't work using loadMovie. any ideas on that? if i have to, i can create a generic dropshadow and position and scale it accordingly, but again, i will need to be able to read the size and position of the empty movieclip.
Code:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();[code]...
View 5 Replies
Similar Posts:
Apr 11, 2006
I am needing to load an external image (probably jpg) into a movie. I am using an empty movie clip, giving it an instance name and the code:
Code:
instance1.loadMovie("image.jpg");
What I also need to do is be able to either place that image in a specific location on the stage or just center it. Any advice you can give me on that?
I am attempting to do something like this: Use two movie clips. One is a holder that contains the second movie clip, which is where the image is actually being loaded. Then, I am using the following math:
Code:
instance1.isntance2.x - instance1._width/2 instance1.isntance2.y - instance1._width/2
Does this look like it would work? Is there anyway I can set instance1 to have a width that is equal to the size of the main movie (1024 x 768)?
View 12 Replies
Jan 30, 2007
did the tutorial on this site for an xml image gallery - it worked great... My question would be is there a way to accomodate for multiple image sizes that would allow the image displayed to be centered?
View 1 Replies
Dec 5, 2009
I have created this Flash site: [URL] But i am having a problem. Under "Gallery", each picture, is a movieclip, which loads a picture from my server. But the pictures aligns to the top left corner of the MovieClip. How do i make them align to the center of the movieclip?
[Code]...
View 0 Replies
Mar 7, 2006
Is there a way to center images that im am loading externaly using XML. Im new to this xml business and have found myself in over my head.
View 2 Replies
Oct 28, 2005
I have an index.swf that it's dimensions are 1020x610, now when I load content in a container in the index.swf it will be centered using an onResize stage listener, that works fine but only if the loaded content is 1020x610, I've also used an onEnterFrame that checks if the width and height are !=0 so that way it waits for it to load before centering the content.
What should I do to always keep my content centered. Lets say I want to load a swf that is smaller (ie the 1st frame only contains 1 element that is smaller than the stage dimensions) I'm not sure if I'm explaining this well....
View 6 Replies
Aug 21, 2009
I'm trying to center a dynamically loaded jpeg to the stage. The jpegs are loaded via xml to a movie clip called 'picture'. I have the code below which works fine on my computer, however, when trying it on a live server I sometimes get a problem where instead of centering the image, the image ends up with its left edge aligned to the center - which suggests that the code didnt get the image width properly. This only happens sometimes, not all the time so must be something to do with how its loading.(code is partly based on xml slideshow found on here somewhere)
Code:
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();[code].....
View 2 Replies
May 14, 2009
I'm told that the following chunk of script will center the stage on resize, but not knowing much of anything about actionscript,
myListener = new Object(); myListener .onResize = function () { ... } Stage.addListener( myListener ); // later ... Stage.removeListener( myListener );
View 5 Replies
Dec 3, 2011
I have a movieclip on the stage which has the dimensions 400x400.I currently load images,and add them to this component.Each image is a different size. At this moment in time, they are placed at position 0,0 within the movieclip container.Some of the code looks like
var data:XML;
var total:Number;
var url_list = new Array();[code]....
Is there anyway I could get the loaded images placed at the center of the movieclip container.I dont know if I have to do something like subtract the images width and height from the containers width and height, and then divide by 2?
View 3 Replies
Aug 9, 2004
what it has to do is to generate "j" buttons (j being the number of registrations from my database) and arrange them in rows of 5 or 6. unfortunately the buttons are generated but are not arranged properly. i have 9 registrations in the database so there are 9 buttons... the first 8 are next to each other and the last one is somewhere to the right.further on, at the release of a button it should create the lwLogo movieclip and load there a certain pic (the path being taken from my database). then the lwLogo mc should be centered on the screen... as this doesn't happen in the _root the center of the screen would be -442 in this movie clip so normally to center the image i should place lwLogo at -442-(lwLogo._width/2) but this doesn't work. the photos are loaded but not in the center.[code]
View 3 Replies
Dec 31, 2010
i've created a rotating banner with images and wanted to increase the stage size so i can put an opaque larger image in the background and have the other images rotate on top of it. when i made the stage larger i'm having difficulty selecting the other photos so i can center them back on the on the stage. i was able to get the first image centered but i only see the outline of the other images.
View 3 Replies
Mar 17, 2011
I'm developing an ActionScript 3.0 app for Blackberry Playbook. I have a Loader with a fixed size of 240x240px. The images that can be loaded inside are smaller or bigger than 240x240px, and also they aren't squared. I use this code to resize that images:
[Code]...
View 1 Replies
Oct 2, 2003
Im having problems of centering my images dead center of my resizing frame.
heres the code:
// All the credits go to Gorlim from www.flashxpress.net
// You need 2 clips in the library: btn and fond
cmpt = 0; //handles depth to attach
[Code]....
View 4 Replies
Dec 4, 2011
Im trying to use a Loader component to add images to my flash file externally because i need to use a single loader for multiple images of various sizes the centerpoint is forever changing the centerpoint is ALWAYS to top left (as seen in image) and i cant figure how to change it.Ive used the following actionscript 2 code which i would have assumed it would center it fine but its never truley centered.[code]
View 1 Replies
Feb 4, 2011
I'm working on a fullscreen application that doesn't run flash on the browser. Running Flash player 10. When you open the file, I have fscommand to run fullscreen, the flash file is built at 1280 x 800, and I have an image (menu screen) that starts off the flash file. I'm trying to find a way to center the image to the native SCREEN resolution, not the flash resolution. Is that possible?
I have this code running on the menu MC:
onClipEvent(enterFrame){
this._x = Stage.width /2;
this._y = Stage.height /2;
}
I've tried other variations of this, and no luck. On my 1280x800 native resolution monitor, it's great. Tested it, and it works. However, if I run the same file on a 1920x1080 monitor, the image is on the lower right hand corner. Also, the image at the moment has a center anchor point, but I'm sure you realized by my simple code. Also, just escaping the fullscreen mode, and scaling the window also screws up the formula. So I'm not sure what I can do to make it dead center no matter the screen res, or size of window. The reason I need to do this, is also because there are times where I have to change the flash resolution, and I don't want to go into the image everytime to adjust the center.
View 1 Replies
Sep 11, 2006
I've been going through the tutorials and forum trying to build a photo slideshow. I managed to get the slideshow working with buttons, but am really stuck with trying to center the images ... I'm using portrait and lanscape images, and want them both to be vertically and horizontally centered in a 504x504 moive.
View 2 Replies
Jan 21, 2010
I'm looking for the best way to get a flex 4 image object to resize and horizontally center whenever its parent container (a custom component based on group) resizes. I cannot set horizontalCenter="0" to accomplish the image centering because I use a move transition to "slide" the image in and out of view.
I'm externally setting the image source in the component. Here is a simplified example of my component code that only addresses resizing the image.
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" >
[Code].....
View 2 Replies
Jun 13, 2010
I did a website using actionscript 2 where the content was centered on the browser window both vertically and horizontally.
e.g. [URL]
all that took was a small piece of actionscript code that i can't remember now.
Now using actionscript 3, I can't find such code anywhere, instead I am guided towards using dreamweaver and css which seems like a nightmare for me to achieve. Such a fundamental thing should be possible with minimum effort surely?
Also, I have a similar problem where I'm trying to repeat tile or just add a textured background behind the stage. This also seems like I'm having to use html/css to achieve. I'd rather just use flash if possible??
View 1 Replies
Dec 13, 2007
Some images I load dynamically are too big so I would like to scale them to fit the stage.
[Code]...
this returns 0. Why does it return 0 when the image loaded is obviously much larger then 0 pixels. How do I change the width and height of imgCont to a specified dimension.
View 1 Replies
Jul 28, 2011
I have my main swf (swf1), that loads another swf(swf2). At some point, swf2 loads an external image. What's the best way for swf1 to align the loaded image from swf2??
View 2 Replies
Oct 2, 2009
How should I go about cloning an image loaded form the server and adding it to the end of the first image loaded? Would I use bitmap clone? My attempts with this failed[URL]
Code:
//Creates new image loader
var imageLoader:Loader;
[code].....
View 1 Replies
Feb 29, 2012
want to get the loaded image path location,how to get the path
<mx:Image source="@Embed('assets/image001.png')" x="240" y="41" width="148" height="118" id="img"/>
i need to get this address source="@Embed('assets/image001.png')" how?
View 1 Replies
Jun 10, 2009
I am trying to replace some code which loaded an external image and triggered and function once completed with code that uses and embedded image. The relevant code looks like this.
Code:
[Embed(source='globe.png')]
public function Globe()
{
var imageLoader:Loader = new Loader();
[code]....
The commented out section is where it used to take the loaded image and apply it to a texturemap.I need to replace the lines of code in the first function with something that calls the second function correctly.
I have tried using function imageLoadComplete (e:Event = null)and calling it with imageLoadComplete(); in the first function but although it compile and runs without error, the program does not work properly. I suspect this is to do with the dispatchEvent(); line which I do not understand.
View 4 Replies
Jun 1, 2009
I've having a weird issue with images being cut off when i load them into flash... I'd like to load in a "strip" that i made in photoshop. This strip can be as long on a 3600+ pixels wide. I'm completely confused on this as i made a file successfully loading a strip image in and it works great. So, i COPY the file and change the image to a new on...and it gets cut off. Same code, same everything, but EVERY (including the one that successfully loads) gets cut off in any new file i make. I DON'T think it's the code as it's worked once, but something with settings maybe?
View 1 Replies
Mar 27, 2010
The images only loads into the last MC, how to make it load into each MC?
private function imageHandler():void {
imageBox=new MovieClip();
imageBox.graphics.lineStyle(5, 0xFFFFFF);
imageBox.graphics.beginFill(0xFF0000);
[Code].....
View 1 Replies
Feb 7, 2009
i know this has proberbly been covered before, but how do i do this:i want my script to run a function only after an image has loaded using loadMovie
is that possible?
View 3 Replies
Nov 9, 2011
I have loaded an external image into a movieclip (say mcA) using MovieClipLoader.
In AS3, we can use addChild to add a movieclip into another movieclip or sprite, but in AS2, we have to use attachMovie to attach the movieclip from the Library. Since this is an external file on server, I cannot use attachMovie.
I need to add the content of mcA, i.e. the image, to another movieclip (say mcB) so that both mcA and mcB contains the same image.
How can I do this in AS2 without loading again the image from the server?
View 3 Replies
Jun 10, 2010
I load many images simultaneously with different Loader class. When loaded I add content of loaders to the movieclips which are child of some other movieclip which is child other... I check that images are loaded addChild method is called, but loaded images cannot be seen on the screen.
Actually, sometimes images can be seen, but sometimes cannot be seen.
Do I need to rerender some DisplayObject? Something similar...
View 1 Replies
Sep 23, 2011
I'm loading images from xml file. I want the images to have standard width when they are displayed.
Here are the snippets of the code that do the image processing:
var allThumbs:MovieClip = new MovieClip();
addChild(allThumbs);
allThumbs.width = 200;
allThumbs.height = 200;
[Code].....
this lines, where I wanted to resize the images before they show up in the ScrollPane.
View 1 Replies
Jan 12, 2009
I have created some movie clips dynamically using createEmptyMovieClip. Then I am loading images into the clips using the MovieClipLoader. In the onLoadComplete of the loader I am trying to position the clips based on the _width and _height.
I would think that since the clips are loaded as indicated by the OnLoadComplete firing they would have a _width, but it comes up as 0. What gives?
View 3 Replies