ActionScript 2.0 :: Center Dynamically Loaded Picture?
Nov 22, 2007How do I center dynamically loaded picture?[code]...
View 3 RepliesHow do I center dynamically loaded picture?[code]...
View 3 RepliesI just want to center my dynamically loaded movieclip, into it's container box. Not center on the stage, but make it center with the container_mc it loads in.
You know when you load a external swf, it loads from the top left corner. How can the loaded image or movie load centered instead of aligned top-left?
I am actually using the XML thumbnail gallery here at kirupa. [URL]
how can i resize the dynamically loaded pictures: i have around 100 pictures, and i don't have the time to make thumbnails from every picture. i'm thinking to change the image size to display the thumbnails.In the xml i want to put only the <image>the link of the picture</image> code, and in flash i want to resize this image that will be displayed in the thumbnail scroller.
View 4 RepliesI have several images that are loaded dynamic.Now I want them to center in the container.How is that done? I can get the width and height but I can't adjust the x values on the loaderinfo object. Heres part of the code:
... part of function ...
for (var i:uint=0; i<numPictures; i++) {
var pictLdr:Loader = new Loader();[code].......
I've read a few of the other threads on this subject but still had no luck. I'm loading jpgs via an xml file and the pics are all diffrent sizes. I'm trying to figure out how to center the image once loaded, but am running into brick wall after brick wall.[code]...
View 1 RepliesI have created a slideshow, in which image is loaded dynamically from a xml. the issue is the images gets aligned to left ,top position by default. i want it to center align.
View 7 RepliesI have created a slideshow, in which image is loaded dynamically from a xml. the issue is the images gets aligned to left ,top position by default. i want it to center align.
View 7 RepliesIf I find the the stage width and the stage height and divide each one by 2 then I know where the middle of my stage is. However, how can I use that point to be the middle of the image that I display on the pop up?
View 2 RepliesI want to make a picture gallery and use buttons that move you from picture to picture and backwards, but I don't want to tell button 1 to go to frame 2 and button 2 to got to frame 3 and so on (I hope you know what I mean)Can I use on button on a separate layer with the same action set? I tried something like that, but it didn't work:
on (release) {
thisframe =+1
}
[code]........
but it didn't work. I'm kind of new to any action script other than gotAndPlay, easy functions and all that.
I want to load a big background-picture into my Flash, and then I want it to be resized so it fits the screen-resolution that the user has on his/her browser.[url]...
it loads perfectly, and - from what I can see - keeps it's dimensions.but it does not resize to the size of the browser as it should....if you go to the link, and then manually resize the browser-window, you'll get the resizing of the background-picture going on, though.[code]...
I'm testing this idea of mine, but so far I've not been awarded succes.so, here's what's my idea about:I want to load a big background-picture into my Flash, and then I want it to be resized so it fits the screen-resolution that the user has on his/her browserit loads perfectly, and - from what I can see - keeps it's dimensions.but it does not resize to the size of the browser as it should....if you go to the link, and then manually resize the browser-window, you'll get the resizing of the background-picture going on, though.here's how it's all build:I have a test100.fla with a test100.as Document Class
test100.as:
Code: Select allpackage {
import CustomBackgroundTest;
[code]....
I have a presentation with various embedded and external videos linked to it. I need them to be positioned in the center of the screen no matter what resolution the user is running, therefore I need to position them dynamically and not with specific co-ordinates. I have found a link and some code that does this, but its a big chunk of code and I would like to put this code in my main .as file, as a function, and then in my main timeline when I have a video - just use one line of code to call the function and apply it to a movieclip with the video inside.[code]...
View 3 RepliesI'm doing a little photo rotation front-end for a site I'm working on. It's a custom photo gallery site that needs to have a photo rotation functionality to it. The back-end developers couldn't find a decent way to do it in Javascript, so they've come to me to figure it out in Flash.They pointed me to the Flickr rotation tool as an example. Seems like it should be straightforward:Load photo into empty movie clip on stageRe-center photo movie clip to the stageUse left/right rotation buttons to rotate image in 90 degree incrementsThat said, I'm having a tough time, after I load a photo into the empty movieclip, using a rotate left and rotate right button to spin the photo around. Obviously, the registration point is in top-left corner of the photo movieclip when the photo is loaded.
I've read that rotation can be managed by putting the clip to be rotated into an outer clip, but...there's a catch......I won't ever know what the exact size of the photo being loaded is going to be, so I can't set the outer clip to a certain size. I only know that it will never be wider than 100px.
I have a presentation with various embedded and external videos linked to it. I need them to be positioned in the center of the screen no matter what resolution the user is running, therefore I need to position them dynamically and not with specific co-ordinates. I have found a link and some code that does this, but its a big chunk of code and I would like to put this code in my main .as file, as a function, and then in my main timeline when I have a video - just use one line of code to call the function and apply it to a movieclip with the video inside.
[Code]....
I am new to flash and I created a gallery that loads the pictures from an xml file. I was wondering how I could create the links to each picture dynamically from the xml sheet in a seperate movieClip named "menu_mc".
View 5 RepliesUsing the new 3D features in CS4. I know you can change the 3d center point manually via the Transform panel, but does anyone know how to do this dynamically at runtime? (ie via code)
View 1 RepliesHaving trouble with this one, let's say I have a 800x600 stage with a movieclip on stage. Now inside this mc I have a red dot thrown randomly somewhere inside. How can I make my mc move so that it centers that red dot to the center of the stage? I need the animation to be dynamic but I can't figure out the formula to do it
View 4 Repliesi have a triangle that i generate using the following code:
Code: Select allinternal function generateTriangle(w, h, topPoint, color = "0xFF9900") {
var triangle:MovieClip = new MovieClip();
with (triangle.graphics) {
[Code]....
I use this function and a foreach loop to generate 9 differently colored and sized triangles, which works fine when i place them on the canvas. But if i try to rotate them they rotate around the 0,0 point - i want them to rotate around the center of the individual triangles, how do i do that?
1. How do i move a dynamically generated triangle inside a movieclip? Solved using [URL]
2. How do i access each of the triangles inside the movieclip, or even better, place them in 9 different movieclips using addChild so that i can move them around individually?
I'm finishing up a project that has a grid of 60 buttons -- two different button movieclips on which I've done some scripting for links, alpha tweens, etc. Each instance of the movieclip button is uniquely named.
In side each of the two different style of movieclip buttons is a dynamic text field that, unfortunately, is sized to the dimensions of the movieclip background. Thus, when dynamic text is pulled in (from XML-based arrays) to populate the movieclip buttons, it is top aligned if only 1 line long. Given this current setup, how can I dynamically center (vertically and horiztonally) the dynamic text field within each of the two movieclip buttons?
center the loaded .swf(external swf) using as3 and it will still stay centered when the browser is resized?
View 6 RepliesI need to establish size of picture (*.jpg) loaded in swf file. I used this script for load the picture:
_root.createEmptyMovieClip(picture, 9876);
loadMovie(obrazok.jpg, 9876);
trace(picture._width);
but traced number is always 0 however the real size of picture is 256 x 192. How should I change the script for it works?
I've got this simple code here:
this["recipe"+i] = new recipelistname();
this["recipe"+i].buttonMode = true;
this["recipe"+i].recipeid = i;
[Code]....
The problem is that the movieclip rotates around the center. The textfield inside the movieclip is starting at 0,0. But it still rotates around the center, how can I make it rotate at 0,0?
I'm trying to see if there's a way to change the registration point of a MovieClip that's importing an image dynamically?Here is my code where I add an image to an "overlayHolder":
overlayBitmap = _loader.getBitmap( _data.id + "-overlay_image" );
overlayHolder.addChild(overlayBitmap);
overlayHolder.x = _data.overlay_left;
overlayHolder.y = _data.overlay_top;
What I need to do is rotate this image later on, upon interaction from someone, but need it to rotate with a center-registration.I've seen a bunch of tutorials/forums talk about centering a registration point when you're drawing a Sprite on the stage, but not when you're importing an image.
I have created an empty movie clip in the root, I load dynamically some jpg to the empty movie clip, but now I want to center it and I can't I have this code, it centers the movie clip but on the registration point of 0,0 not in the middle of the movie clip so the movie clip will show up nice and centered.
ActionScript Code:
var stageL:Object = new Object ();
stageL.onResize = function () {
[code]....
This is the code I'm using which loads in external swf's in 2 loaders, replacing each other. I just to center the main clip(tl) in the main swf, and can't figure it out![code]...
View 13 RepliesI have a question to center an animation within its container.This is the container or loader:
public function Main():void
{
trace("Constructor...");[code]......
In canvas, I have the code:
onClipEvent (enterFrame) {
// Make canvas dynamically resize to whatever is loaded in imageClip clip and width and height matches (and only when ttally loaded )
[code].....
I've got these images that are being loaded into an MC called imageClip, and another MC called Canvas underneath it.In canvas, I have the code:
onClipEvent (enterFrame) {
// Make canvas dynamically resize to whatever is loaded in imageClip clip and width and height matches (and only when t�tally loaded )
[code].....
i am trying to make this xml gallery that dynamically resizes according to the picture's width & height. the function resizer() is hardcoded with fix values. i have tried to assign it from the array like below but it works wierd, the border just keep increasing in size.
Code:
menuHolder["but"+i].onRelease = function() {
imageLoader.loadClip(this.path,gallery.imageHolder);
gallery.imageBorder.tween("_width",this.width,1,"easeOutExpo");
[code]....
Can I trace the width of a loaded picture? I thought it would work something like this, but it won't work..
View 5 Replies