Centering Thumbnails
Hi
I am using Flash CS3 and am trying to implement a flash/XML gallery. The user is allowed to upload images to the gallery and php automatically creates a thumbnail. The gallery basically consists of a main image with scrolling list of thumbnails.
All is working well except that the thumbnail images can be of different widths.
I want to be able to center the thumbnails on my flash movie. The thumbnail images are displayed using a button. I have a rollover event that centers the thumbnails perfectly, but I cannot get the thumbnails to center without the rollover.
I would be gratefull if anyone would assist me with the code below.
Thanks in advance.
Jenny
/// actionscript ///
tn_group.tn._visible = false;
tn_width = 120; tn_height = 90; tn_group.setMask( tn_area ); tn_alpha_default = 70; p = 0;
for( var i = 0; i < photo_thumbnail.length; i++ ) { tn_group.tn.duplicateMovieClip("tn"+i, i);
tn_group["tn"+i].tn_pic.loadMovie("gallery_images/" + filepath +photo_thumbnail[i] + "?" + new Date().getTime());
//tn_group["tn"+i]._x = (tn._x - 120); tn_group["tn"+i]._y = i * 100;
tn_group["tn"+i].tn_pic._alpha = tn_alpha_default; tn_group["tn"+i].tn_no = i;
mywidth.text = tn_group["tn"+i].tn_pic._width; myheight.text = tn_group["tn"+i].tn_pic._height;
var center = ((tn_width) - (tn_group["tn"+i].tn_pic._width)) / 2 ; groupwidth.text = center; tn_group["tn"+i].tn_pic._x = center;
tn_group["tn"+i].tn_button.onRollOver = function() { this._parent.tn_pic._alpha = 100; mywidth.text = (this._parent.tn_pic._width)/2; myheight.text = this._parent.tn_pic._height; groupwidth.text = ((tn_width) - (this._parent.tn_pic._width))/2; var center = ((tn_width) - (this._parent.tn_pic._width))/2; this._parent.tn_pic._x = center; }
tn_group["tn"+i].tn_button.onRollOut = function() { this._parent.tn_pic._alpha = tn_alpha_default; } tn_group["tn"+i].tn_button.onRelease = function() { _root.p = this._parent.tn_no; _root.play(); } }
onEnterFrame = function() { x_mouse = _xmouse; y_mouse = _ymouse;
if( x_mouse > tn_group._x - 10 and x_mouse < tn_group._x + tn_group._width + 10 ) { y_speed = -(y_mouse - y_middle ) / 50;
if( y_mouse > y_middle ) { if( tn_group._y > tn_area._height - tn_group._height + tn_area._y ) tn_group._y+=y_speed; } else { if( tn_group._y < tn_area._y ) tn_group._y+=y_speed; } } }
FlashKit > Flash Help > Flash ActionScript
Posted on: 03-21-2008, 08:43 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Text Over Thumbnails: Adding Thumbnails Photo Gallery Using XML And Flash Tutorial
So I went through the adding thumbnails supplement to the XML Photo Gallery (http://www.kirupa.com/developer/mx2004/thumbnails.htm) and it works great. I wanted to put the label of the image over the thumbnail when the user mouses over the thumbnail. Any thoughts on how to do this? I want it to look like these thumbnails http://www.commonskymedia.com/index.html#reel. Thanks!
Thumbnails Tutorial - How Can I Make The Thumbnails Scroll By Default?
i have modified the xml photogallery on my site as i only want to use the scrolling thumbnail component but as a tool to scroll images.
2 modifications i would like to make that have me stuck!
1) how can i make the thumbnails scroll by default on load?
2) how can i add a little preloader within the empty thumbnail holder movieclip? i am loading the main gallery images directly into this clip rather than using it to display thumbnails
many thanks in advance if you can help!
natalie
Extra Thumbnails To "Adding Thumbnails"
I've searched the forum but there is not a certain solution. (http://www.kirupa.com/forum/showthre...tra+thumbnails)
I am trying to add the gallery extra thumbnails to use as extra information. Shortly trying to make a little thumbnail which will be change when clicked the main thumbs as the example below..
Thanks for your help if u can...
Centering A MC
I need a simple way of centering one MC over another MC
Thanks
Darin
Centering Your SWF
Alright this one has me confused. I have tried the publish settings and all.. I can not get my SWF to center in a browser window... I would really appreciate it if you caould me out... thx
Centering IE Etc
Hello
i was wondering how one can centre a flash site on the net
from right to left top to bottom
Centering
How do i get my flash movie to be in the center of the webpage?
Centering
Is there a way to center a flash file dead center in the middle of a browser. I don't want it to match the browser window size, just center it.
Help With Centering
I feel like I'm going crazy.
Here's my question:
How can I make the Info panel recognize the center of the stage as 0,0, rather than the upper left corner of the stage? I know I've done this before, but I can't figure out how. A lot of my older movies have this - but I can't figure out how to do this with my new ones. The reason I like it is because I know things are evenly spaced if they are -25,0 and 25,0 etc.
Does someone know this (probably) simple answer?
Thanks
Centering
Code:
loadMovie("home.swf", "loaded");
loaded._x = loaded._x - loaded._width/2;
loaded._y = loaded._y - loaded._height/2;
thats on the first frame of the index movie
various movies are being loaded into the index movie.
i want each movie to have a different size but each needs to be centered.
cant get it to work yet...any help would be appreciated
thanks
-2
Centering Help
i am using a blank mc container to call in some images dynamically.
the images are different sizes and end up not being in the center of my content area because of the differnet sizes. is there something i can tell my container to make them center insted of all starting from the top and left.
like...can i place something inside that blank mc...like another mc in the center of it?
follow me?
i am pulling hair.
c
Centering
Hey, take a look at this:
http://www.norwaysays.no/
See the centering technique here (resize you browser),
I know they may using onResize but how do they do the "after" resize, and the transition(tween) to center it?
Can anyone help
S
Centering
I haven't used Flash is a while. Isn't there away to set it up so that no matter what resolution someone has their monitor on, that when your website comes on, it automatically centers in the middle of their monitor?
Please help if you can
Thanks
Treena
Centering?
Stupid question. I'm working in Flash MX 2004 and I can't center my flash movie. I keep publishing it with the settings to make it centered but everytime I open the html file it doesn't work. It's always flush left.
How can I center it?
Any help I'd really appreciate.
Thanks,
Jeremy
Centering Pop - Ups?
i have a website (pop up based). but the problem is that on my screen, (1280 x 1024), it looks fine, but when i launch it another computer, the pop up is way off screen.. is there a method to center screen the pop - ups??
and btw, which is the best method of pop-ups,,
using a javascript:window.open(blah blah) or using an fscommand(which i need some help) ????
Centering
I need to center an flv, is there any code to do this?
Centering?
I just published my first site in Flash 8 and just used the generic html publish that comes with it. I was astonished to view my site on a computer with one of those new short wide screens and see that it wasn't centered in it. I used to have to put centering html code in all my flash by hand in the old days with MX but I figured that with Flash 8 Macromedia, nay Adobe, would have figured out how to write html centering code. Am I nuts? Is there something I am missing in the automatic publishing process? Or do I still have to go through every html I publish with flash 8 and enter a div tag with a table and row and cell and center it? Thanks.
Centering
Alright, I'm fairly new at uploading and designing websites. I just finished updating mine and have yet to figure out how to center it in the browser. I know practically nothing about HTML or Java or any of that. I only used Flash MX 2004 professional and used a lot of the basic action scripting and what I've learned in some tutorials. It has a publishing option to center the movie but it doesn't seem to work. Can anyone help me out on what to do? Please be as detailed as possible. You can check out my site at www.jeremytomsart.com It may look like it's center on some computers, but trust me it's not. I just made the stage large enough to appear more in the center. Any help would be greatly appreciated. Thanks in advance.
Centering
Is there a way to center a movieclip in the movie? I have my SWF resizing to 100% wide but not height in the html document. Is there a way, maybe with actionscript, that you can cetner the movieclip?
Remember I'm a big noob so details are good.
Thanks!
Swf Centering
i am trying to center an swf into the stage
i am using this code below to resize it and then center it
the resize part works fine but the mc loads off center
this.createEmptyMovieClip("mc", 0);
mc.loadMovie("DBdriven//2.swf");
mc._xscale = mc._yscale=sized(mc._height, mc._width);
mc._x = (Stage.width-mc._width)/2;
mc._y = (Stage.height-mc._height)/2;
function sized (H, W) {
// get he actual value of container
var _w = W;
var _h = H;
//trace(_w+""+_h);
// set the dimensions of the page
var maxW = Stage.width;
var maxH = Stage.height;
var scaleX = scaleY=scaleFactor=80;
var scaleX = scaleY=scaleFactor=80;
if (_w>maxW) {
scaleX = maxW/_w*100;
}
if (_h>maxH) {
scaleY = maxH/_h*100;
}
scaleFactor = Math.min(scaleX, scaleY);
return (scaleFactor);
}
Help On Centering
I have a problem on centering my flash document in my website. When i publish it, and upload it to the file manager in my web host, it's align farthest to the left. Kind of weird. I centered it aligned to the center of the document in flash. I want it set in the middle in my website. Can anyone help me on this?
Centering
Hello i have a gallery in flash right now that loads up each indiv. jpg when each thumbnail is clicked. How can i get it so that when each jpg comes in it comes directly to the middle of the movie no matter what size.
This is all i have right now
on (release) {
loadMovie("ex26.jpg", "_root.screen");
}
If someone could give me insight or help me out thad be greatful.
Thanks
Centering Swf In FBF
Hi there,
I am quite new toAS...but I try to figure how to center a loaded swf which is loaded into an empty MC.
I did get it to work with loading a jpg dyn. it centers perfect and even on resize.
But the swf is centered horiz. but not verti......only after resize.
If someone can help me out¿¿¿
cheers
btw heres the code :
Stage.scaleMode = "noScale";
Stage.align = "TL";
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
target_mc._x = (Stage.width - target_mc._width) / 2;
target_mc._y = (Stage.height - target_mc._height) / 2;
};
this.createEmptyMovieClip("myClip_mc", 1);
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mclListener);
img_mcl.loadClip("loadCenterSWF.swf", myClip_mc);
ss_mc.swapDepths(myClip_mc);
var stageL:Object = new Object();
stageL.onResize = function() {
var stageXCenter:Number = Stage.width * .5;
var stageYCenter:Number = Stage.height * .5;
var b = myClip_mc.getBounds();
stageXCenter = stageXCenter - (b.xMin + myClip_mc._width*.5);
stageYCenter = stageYCenter - (b.yMin + myClip_mc._height*.5);
myClip_mc._x = stageXCenter;
myClip_mc._y = stageYCenter;
};
Stage.addListener(stageL);
------CENTERING------
Hi,
I bought one of those flash templates online. I am now ready to install it with our service provider. When I run the swf file everything looks perfectly aligned. However, when I run the index file (I'm told I need because it calls the sfw file from within) my swf file is left of center.
Any ideas how I can get it to run like the sfw file? The swf file even has it automatically resized to it's max potential (perfect size). The html file just opens the full screen mode and there is my tiny, little image off to the upper left.
Thanks
G.
CENTERING
Dear Flash People,
I am a self taught Flash user working on a 1.25ghz eMac.
I'm having trouble trying to centre my Flash project in the browser window. As far as I can see I have set the options in the HTML publishing options box before publishing, as per the manual I use, but it just wont centre. It just plays on the left hand side (Incidentally playing with the options left/right/top/bottom seems to make no difference at all, whether it's in the HTML or Flash alignment option menus).
Can anyone help? I just can't see what's going wrong here.
Many thanks
Tonyhandlebars.
Centering Swf
Can anyone point to a resource that would help me design a site that used a centering swf?
Imaginaryforces.com and skuadstudios.com both use similar techniques so it seems to only be a secret from me.;)
It's not just the centering but the address and a menuing system being sensitive to window size/shape that perplexes me. Are there any good books that cover these kinds of techniques?
THX
rg
Centering Pop-up
I got XML Gallery working but now when I use
Quote:
on (release) {
getURL ("javascript:openNewWindow('products.html','thewin ','height=500,width=340,toolbar=no,scrollbars=yes' );");
}
it pops up uncentered, and off to the left a bit, and is still scrollable with the scroller on the mouse even when i set scrollbar = no. Anyway to center it and not allow it to scroll?
thanks ahead
Centering An Mc
hey guys,
here's the deal, I have a main swf named index.swf with only 1 frame, on that frame I have actionscript that creates an empty movieclip loads an external swf and centers it depending on the user's browser size.
My problem is if I load an swf that doesn't take the whole 1020x610 of the index.swf it won't be centered. It's kind of hard to explain. so here's some of the code.
ActionScript Code:
this.createEmptyMovieClip("container",this.getNextHighestDepth());container.loadMovie("../swf/splash.swf");var stageXCenter:Number = Stage.width * .5;var stageYCenter:Number = Stage.height * .5;stageXCenter = stageXCenter - (container._width * .5);stageYCenter = stageYCenter - (container._height * .5);container._x = stageXCenter;container._y = stageYCenter;stageListener = new Object();stageListener.onResize = function():Void { stageXCenter = Stage.width * .5; stageYCenter = Stage.height * .5; stageXCenter = stageXCenter - (container._width * .5); stageYCenter = stageYCenter - (container._height * .5); container._x = stageXCenter; container._y = stageYCenter;}Stage.addListener(stageListener);
Any help would be greatly appreciated
Centering?
How do I get my website in the center of the webpage now matter how big my window is?
Centering Until A Certain X Value
Im stumped, I know theres probably a simple solution but it's escaping me at the moment.
I have a centered swf, I want it to stop centering if the swf reaches the side nav so they dont overlap.
function Center(mc) {
mc.onEnterFrame = function() {
if(mc._x >500){
mc._x = Stage.width/2;
mc._y = Stage.height/2;
}
};
}
this stops the centering when it hits 500, but it stops all centering because it's stuck on 500.
Centering
my flash website is 640x480, how would i center the movie in the web browser?
Centering
Hi, I saw this question in here once but i cant seem to find it. The question is does anyone know the code for your flash file to center it right in the middle of your page. All i remeber it had something to do with tables.
thanks again, here is a example of what I am talking about. If anybody wants to see it.
http://www10.brinkster.com/soundgraphy/angklung/
Centering?
How do I have my flash doument align in the middle of a html doument. In the center of the page? Is there some code?
Can Someone Help With Centering MCs
I guess I must've hit submit instead of preview. I apologize if this has created a mess.
I wanted to center an instance of a MovieClip entitled "circle" in an instance of a MovieClip entitled "square" using the following syntax:
this.circle.centerIn(this.square);
and this is what I tried, but it didn't work. Any ideas?
ActionScript Code:
MovieClip.prototype.simpleCenter = function(standingDim:Number, movingDim:Number):Number {
var moveAmount:Number = int((standingDim-movingDim)/2);
// int can be replaced (or not) with Math.floor, etc.
return (moveAmount);
};
ActionScript Code:
MovieClip.prototype.findCenter = function() {
var center:Array = new Array();
var bounds:Array = this.getBounds();
center["x"] = (bounds["xMax"]-bounds["xMin"])/2+this._x;
center["y"] = (bounds["yMax"]-bounds["yMin"])/2+this._y;
return (center);
};
ActionScript Code:
MovieClip.prototype.centerIn = function(someClip:MovieClip, centerType:Array) {
//check to see if option "centerType" exists
if (centerType == undefined) {
//if not defined, center on both X,Y vertices.
var centerX:Boolean = true;
//center Horizontally
var centerY:Boolean = true;
//center Vertically
} else {
var verticalOpts:Array = ["v", "V", "Vertical", "vertical", "VERTICAL", "Y", "y"];
//list of vertical label options
var horizontalOpts:Array = ["h", "H", "Horizontal", "horizontal", "HORIZONTAL", "X", "x"];
//list of horizontal label options
var centerX:Boolean = false;
//initialize the horizontal flag as false;
var centerY:Boolean = false;
//initialize the vertical flag as false;
//iterate across the centerType variable (in case multiple center types were entered) *see below
for (var t in centerType) {
//for every value entered in centerType
for (var h in horizontalOpts) {
//check against possible label options
if (t == h) {
centerX = true;
}
//if matching, set flag
}
for (var v in verticalOpts) {
//same with vertical
if (t == v) {
centerY = true;
}
//see above
}
}
var thisCenter:Array = findCenter(this);
//requires previous declaration of findCenter function
var targetCenter:Array = findCenter(someClip);
//returns an associative array for x and y;
if (centerX) {
//if the horizontal flag is set
var horizDisp:Number = simpleCenter(targetCenter["x"], thisCenter["x"]);
//determine the horizontal displacement
this._x += horizDisp;
//add the horiz displacement to the current horizontal position
}
if (centerY) {
//check the vertical axis?
var vertDisp:Number = simpleCenter(targetCenter["y"], thisCenter["y"]);
//finds the vertical displacement
this._y += vertDisp;
//adds it to the current y position
}
}
};
Centering My Swf...
Hello,
I wondering the best way to center my swf within my web page.
I have it centered already (horizontally and vertically) using html and frames - but the way I have done it seems a bit messy.
Can my swf be centered more neatly using action script? Or do I have to use html as I have done?
Centering Gone Mad
Man, don't you hate it when something that seems so EXCESSIVELY easy and simple doesn't work at all? lol. Can drive you InSAnE!
Anyways.
_root.image_mc.loadMovie("1.jpg",get);
// IMAGE APPEARS AND IS ATTACHED TO THE MC.
imgX = _root.image_mc._width;
imgY = _root.image_mc._height;
// ODDLY NUFF, THESE VARIABLES = 0, GO FIG.
_root.image_mc._x = 380 - (imgX / 2);
_root.image_mc._y = 350 - (imgY / 2);
// THE STAGE IS 760 x 700 SO THAT SHOULD CENTER THE ITEM
// BUT SINCE IMGX AND IMGY CANT CAPTURE THE WIDTH/HEIGHT
// IT MAKES SENSE THAT 380 - (0/2) = 380, SO THE IMAGE DOESN'T
// MOVE.
My problem here? For God's sake, I can't capture the WIDTH/HEIGHT of the loaded JPG! lol.
Centering My Flash.
Ok, i was curious if there is a way to center a flash screen
on the browser depending on what resolution they are using. all i have now is html code that align's the flash to the top left hand corner. Looks good for me but others can see funny things.. any clues??
Centering Actionscript?
i have the following code to print letters using actionscript:
duplicateMovieClip ("_root.words", "words" + i, i);
setProperty ("/words" + i, _x, startx+charinline*kerning);
setProperty ("/words" + i, _y, starty+linenumber*linespace);
set ("/words" + i + "/letters:letter", substring(text, i, 1));
i = i+1;
this justify's all the text on the left hand side. How would i get it so all of the text is centered on each new line?
Also, i seem to be having problems just organizing my movies. is there any particular rules to follow? like put everything within mc's or everything on the main timeline? what is the best thing to do to get good optimization?
Centering A Pop Up Window...
I just finished my buddies band site at http://members.rogers.com/unfairadvantage/
and i have the javascript for the btn in flash as
on (release) {
getURL ("javascript:window.open('http://members.rogers.com/unfairadvantage/news.html','NameofWindow','width=645,height=315,to p=0,left=0'); void(0);");
}
it pops up fine but it goes to the top left of the browser, how do i make it center when it pops up??
Centering Swf Files
How do I get my swf file to be centered in the web browser window?
Is this something I can do through the publish settings or do I need to change something in my html file.
thanks.
*j
Centering Set Of Movieclips
Hey Guys,
Lets say I have 5 movieclips stacked next to each other on the x axis.
These movieclips are duplicated, so I need to find out the math to set the group of 5 clips in the center of the flash movie, so no matter how many clips are duplicated, they will be centered.
I hope I make sense.
I thought about putting all the clips inside an empty movieclip and just centering that, and if this is the easiest way, then I will do it that way.
what do you all think?
dduck1934
Centering The Movie
how can i get my movie to be centered in the window, and not on the top left?
Centering Swf In Page
My flash page is 800 x 600 with allowscale set to false, i want it to be centered in the browser window if the viewer has a higher resolution. Right now if I view at a higher resolution it is placed in the upper left corner?
Centering Pixelfonts Possible?
In a menu I am using pixelfonts for the caption. The caption needs to be centered, but when centering the pixelfont doesn't align to a whole pixel anymore (example _x of pixelfont = 1.3 instead of 1.0 as is necessary). As a result the text gets blurred.
Any Ideas on how I can center the text and still having pixelfont advantages?
Centering Streeamed *.jpg
Here is the thing,
i have the swf that loads the external jpg,
that jpg once is loaded, I need to rotate, resize, scale etc.
I did that script and that all works fine, but I can`t find the way to center that image, so when I`m rotating it, the picture position is y=0, and x=0, and the rotation is not centered it rotates around the y=0,x=0.
Thank you!
Centering Site
Hi, I was wondering what is the code to center everything so that if you fullview it would still be at the same WxH (width & Height) size?
Thank you.
Centering You File
Hello....this might be a java question, but does anyone know how to have your swf or html file automatically centered in the browser window, no matter what the size is? For example, I added a javascript to my HTML-exported flash file that automatically opens it in fullscreen....but I want to page to be centered. Thanks.
-X
Zoom Map With Centering (help)
Ok. I got this to zoom(in, out), and center (sort of).
here are my problems:
1)I need this to center perfectly
currently it seems to just place itself where the mouse is...which works but I want what the user clicks on to appear in the center...(except the edges of the map ofcourse)
2)I need the flags to work IN the movieclip that zooms. I think when it scales the values for the flasg are lost, thus I can't click on them. I need them to pop a small bit of text in a box. Currently I have hittests setup just to see if I could even find them with the mouse.
Please HELP!
I searched through as many old threads and tutorials/movies i could find...none seemed to be exactly what this needs.
I'm posting this as open source.
Here's the swf and fla.
www.subshape.com/stuff/newmap.fla
www.subshape.com/stuff/newmap.swf
Flash Rules
Centering With A Frameset
ok, i need to center a frame in a frameset. i basically want a frameset with 3 vertical columns and i want the middle column to always be centered on the page. any ideas???
|