Help Implementing Scale/center Code
I'm having trouble implementing it though..Attach CodeThis is the code i want to usefunction LoadImage(clip, maxWidth, maxHeight, bordersize, filename) { clip._alpha = 0; clip.loadMovie(filename); onEnterFrame = function() { if(clip.getBytesLoaded() >= clip.getBytesTotal() && clip.getBytesLoaded() > 4){ // Scale scaleW = ((maxWidth - (bordersize * 2)) / clip._width); scaleH = ((maxHeight - (bordersize * 2)) / clip._height); if (scaleH >= scaleW) { newScale = scaleW; } else { newScale = scaleH; } clip._width = clip._width * newScale; clip._height = clip._height * newScale; // Center if (clip._width < maxWidth) { clip._x = (maxWidth/2) - (clip._width/2); } if (clip._height < maxHeight) { clip._y = (maxHeight/2) - (clip._height/2); } // Show clip._alpha = 100; delete onEnterFrame; } };};and this is the loadmovie code i'm currently usingfunction loadGImage(title, bigImgURL){ _root.bigImage.imageContainer.loadMovie(bigImgURL, 100); _root.bigImage.imageContainer._x = 0; _root.bigImage.imageContainer._y = 0; _root.title.text = title; _root.downloadButton.onRelease = function () { getURL(bigImgURL, "_blank"); } ;}
Adobe > ActionScript 1 and 2
Posted on: 04/15/2008 08:43:26 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Scale From Center Of Stage, Not Center Of MC?
I'm building a Flash map that I'd like to be able to scale in and out of. I've added a + and - button and linked them to a 5% + or - of the main MC's x and y scale. But, on press I'd like it to scale from the center of the stage, not the center of the movie clip, so that when I zoom further into LA the whole image doesn't go shooting off to the left, since LA is on the far left of my enlarging MC. How do I do this? Am I on the right track here?:
//onPress increase x and y scale 5%. no prob.
//move the map by combining an understanding of the center point of the MC, the centerpoint of the Stage (half the width, maybe), and then maybe multiplying it by some factor of my current %scale, since a 5% increase is a varying number, depending on my current scale.
Seems like this would work, but I'm not sure what that math would be.
...or is there a better way like a built in method that deals with MC centerpoints?
Thanks,
Greg
Scale Down From Center
I've been trying to get buttons to decrease in size and opacity (from their center) by a factor of 1, using on(release), until the button is 100% transparent and too small to view.
I've tried various methods, but either the button won't scale, or each time it does, it nudges to the top-left of the movie.
Any help would be much appreciated.
::bluemoth::
Scale And Keep CENTER
Hi all
How can I Keep center off my movie when I drag I around
Ive got a slider that scale my map
onClipEvent (enterFrame) {
_root.Map._xscale = (200/50 )* (_root.dragger._x );
_root.Map._yscale = (200/50 )* (_root.dragger._x );
}
My map can be drag around to place of interest.. But when scalling
again it keep its old centerpoint
I guees that I need some code to set the new center point after
it has been dragged around.
Hope for good Ideas
AS3 - Scale From Center?
Each time the square is clicked it scales up a little. What must be added or changed to prevent it from moving off center from its original position, and to have it scale evenly in all directions from its own center?
Code:
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.*;
public class NewTest extends Sprite{
private var s:Shape;
private var sHolder:Sprite;
public function NewTest(){
sHolder = new Sprite();
addChild(sHolder);
s = new Shape();
s.graphics.beginFill(0xFFFFFF);
s.graphics.drawRect(20,20,10,10);
s.graphics.endFill();
sHolder.addChild(s);
sHolder.addEventListener(MouseEvent.CLICK, start);
}
public function start(e:MouseEvent):void{
s.scaleX+=1;
s.scaleY +=1;
}
}
}
Fingers
Map-Scale/Center Problem
Hi all,
I'm in big trouble and I can't understand the thing going on when you scale a movie sequenz. System is Flash 5, I'm working on a citymap for a cd, so please hang on long loading terms concerning the link, it's near to 5 mb size - sorry for that.
http://home.pages.at/genx/flashtest/Stadtplan.html
If you open the page you see a zoom-tool at the bottom, a plus and a minus button, if you press them the map starts to zoom in and out but it also starts to move, in fact its not moving, but the scale is changed and it looks like the map moving out of the film. How can I correct this???? How can I make it look like zooming really to the center of the window (for orientation I drawed a cross over the map!).
I tried different corrections by giving the map new _x,_Y coordinates with the zoom-buttons, but depending on where on the map you are the correction-distance is different to each other.
This is the plus-button script:
on (release) {
if (slidenr == 1) {
setProperty ("GI-Karte", _xscale, 500);
setProperty ("GI-Karte", _yscale, 500);
slidenr=2;
} else if (slidenr==2) {
setProperty ("GI-Karte", _xscale, 600);
setProperty ("GI-Karte", _yscale, 600);
slidenr=3;
} else if (slidenr==3) {
setProperty ("GI-Karte", _xscale, 700);
setProperty ("GI-Karte", _yscale, 700);
slidenr=4;
} else if (slidenr==4) {
setProperty ("GI-Karte", _xscale, 800);
setProperty ("GI-Karte", _yscale, 800);
slidenr=5;
} else if (slidenr==5) {
setProperty ("GI-Karte", _xscale, 900);
setProperty ("GI-Karte", _yscale, 900);
slidenr=6;
} else if (slidenr==6) {
setProperty ("GI-Karte", _xscale, 1000);
setProperty ("GI-Karte", _yscale, 1000);
slidenr=7;
} else if (slidenr==7) {
setProperty ("GI-Karte", _xscale, 1100);
setProperty ("GI-Karte", _yscale, 1100);
slidenr=8;
} else if (slidenr==8) {
setProperty ("GI-Karte", _xscale, 1200);
setProperty ("GI-Karte", _yscale, 1200);
slidenr=9;
} else if (slidenr==9) {
setProperty ("GI-Karte", _xscale, 1300);
setProperty ("GI-Karte", _yscale, 1300);
slidenr=10;
} else if (slidenr==10) {
setProperty ("GI-Karte", _xscale, 1400);
setProperty ("GI-Karte", _yscale, 1400);
slidenr=11;
} else if (slidenr==11) {
setProperty ("GI-Karte", _xscale, 1400);
setProperty ("GI-Karte", _yscale, 1400);
slidenr=11;
}
}
At the top in blue are the actuell coordinates of the map-sequenz, you can move the map by pressing at the blue tool left of the zoom-buttons, or with the green buttons (half-distance change!).
If there are any ideas, any help would be welcome...
If it's possible, as fast as you can, because I'm a bit in time trouble for finishing the hole map.
http://home.pages.at/genx/flashtest/Stadtplan.html
Auto Center And Scale?
Hi ya
Can anyone tell me the scirpt command so that:
1. the swf file (embedded in html) will auto matically center itself in the borwser
and
2. Scale itself down depending on what resolution the client is using (is that even possible)?
Thanks
Hong
Actonscript Scale From Center
Hi I have a very simple page with twelve invisible buttons, I have applied actionscript to grow/shrink the movieclips below on rollover / rollout.. only problem is they are growing from the top left edge.. not the center of the MC.. how can I make the MC grow / shrink from the center??
Thanks
Martin
How To Scale A Mc From Its Center Instead Of Top Left Corner
i am trying to scale an screen centered mc to fill the screen when clicked. when i use the _xscale or _height set properties it scales _x out to the right along the x axis and down along the y axis. basically what i am trying to do is make it grow bigger from the center out, not scale right and down from the top left corner out. how can i do this?? if i make the _x a positive number and then on the next line a negative number, they cancel each other out. there must be some way... hmm... please help!
here is the code i have been using:
redsquare.onEnterFrame = function() {
this._xscale-=(this._xscale-targXscale)/10;
this._yscale-=(this._yscale-targYscale)/10;
};
redsquare.onRelease = function() {
_root.targXscale = 500;
_root.targYscale = 500;
};
its nice when it eases out to the final resting size....
i have tried centering the mc's registration point but that has worked either
Scale Movie To Center By Tween
ok Ive had a really hard time figuring this out, and its driving me crazy. What i am basically going for is an effect like this: http://www.seanjohnblackelite.com/main.htm
Basically its self explained, I need to have it just like that so when the user scales the web browser, it bounces or smoothly slides to the center of the browser, how is this done? I am new to this so if you could explain, or even show an example that would be great! I WOULD GREATLY APPRECIATE IT!!!!! thanks alot!!!!
[F8] How To Scale A Movieclip From The Center Using Actionscript?
Hi, i need to create a dynamic zoom function for a site and i would like to know how to scale a movieclip from the center using actionscript (preferably the tween class).
At the moment im using the tween class to modify the _xscale and _yscale properties but i can only get it to scale from the top left corner, not the center. So what im wondering is if there's any way to modify the transformation point of a movieclip object using actionscript? or is there any other way i can get this to work?
Any help would be great, thx.
How To Scale A Movieclip From The Center Outward?
I have a button which I want to scale the movie screen outwards by 125% when someone rolls over it. The problem I am having is that it scrolls from the top left corner instead of from the center outwards. It is important that the screen scales out uniformly from the center. Please provide me with the proper action script code that makes it scale uniformly outwards from the center. Also, if possible, can I make this scale tween from the center outwards using action script? It would make the animation look much more smoother.
Thanks,
Sam
Scale Multiple By Individuals Center?
Is there any way to scale multiple objects from each objects center?
For example I want to make a sentence of letters increase in size then decrease back to original size, one by one, from left to right. When select all of the letters (broken apart) and scale them, they increase in size proportionally to each others distance. I want each one to scale as if I selected them individually. As if to pop out at you.
Scale Video Object From Center
Is it possible to scale a video object from it's center? I am currently using the below code to resize but I need it to scale from the center of the video object.
ActionScript Code:
function resizeVideo() {
video._width = video.width;
video._height = video.height;
}
Scale 100% Level0 And Center To Browser All Other Levels?
I'm not a complete newbie in flash but i haven't figured out how to do this.
Here goes.. I have a movie loading some background photos on level0 which i want them cover the whole browser and on top of that load on another level my content.
so its level0 which will be scaled
and level5 which will be centered on browser and noscale
for the scaling level0 to stage i found this code
PHP Code:
function onResize(){
bgImageMc._width = Stage.width;
bgImageMc._yscale = bgImageMc._xscale;
if (bgImageMc._height<Stage.height){
bgImageMc._height = Stage.height;
bgImageMc._xscale = holder._yscale;
}
}
Stage.addListener(this);
which doesnt quite work since i have to first resize my browser to play the function.
As for centering level5 i keep looking and haven't found anything yet (i did try loading everything through loader component and then align this to center. This looked promising but then level6 was someplace else...). Can someone save my head?
thx in advance!
Math Help For Zoom/scale On Center Point
Hi,
First I must admit (obviously) that I am very bad with math terminology but am fascinated by how things work, so I usually end up figuring things out but my solution is not always elegant. My problem is on how to use the correct math/functions to achieve some zoom functionality. Here is how my application works.
There are two main windows/views (movie clips)
One is what I call the "proxy"
The second is the "main" view
The proxy window displays the "main" window's full contents, but at 25%. The contents of the "proxy" do not change size or position etc.
The "proxy" window has a mini view finder that you can drag around.
The drag bounds are the inside of the "proxy"
When you drag the "finder", the contents of the "main" window move, in the opposite direction. The idea is what you see in the "finder" is what you see in the "main" window. The "main" window's contents are actually bigger than it's size, but you can only see what is currently inside (mask) of the "main" window.
This "finder" is an empty square with border, and it's size and position represent the current zoom level and position (respectively) of the "main" window's contents.
There is also a "zoom" slider.
When you slide the zoom from 100% (default and lowest setting), the "main" windows contents get bigger, zooming to the center point of the "main" window. The "proxy"'s "finder" then gets smaller focusing in on the center point.
Once you zoom in above 100%, you can then drag the contents of the "main" window. When dragging, the "proxy"'s "finder" also moves to show what is currently being displayed in the "main" window.
The sizes of the "main", "proxy" and "finder" are all proportionate.
If you zoom out (towards 100%), the contents of the window should zoom out from the current center point in the "main" window. For example, if the contents are a map of the United States, and you are zoomed in on Boston, when you zoom out a level, you should still see Boston in the center but zoomed out.
If you are zoomed in on an area at the edge, the center point should dynamically move towards the center of the contents. Example, because Boston is at the edge of the contents (farthest east on the US map), when you zoom out, it should not show the empty are to the right and stick to that center point, but should instead lock/anchor the "main" windows contents to the right. The same should happen to the "proxy"'s "finder".
I know this is all very difficult to understand without seeing.
If someone could point me in the right direction(s) (website, examples) as to where I could go to get help or even tell me what kind of math is involved (trig, geom, alegebra?) then I'd be in better shape.
Thanks for your time,
M
BG Scale/Content NoScale And Center On Browser Resize In AS3
Ok the client is demanding this and it's driving me crazy. In AS3 how do I make a bg image scale to fit the browser 100% width & height, but the main content movieclip doesn't scale, it just recenters itself on browser resize? It needs to work exactly like the Enviga web site: http://www.enviga.com
Anyone know how/if this can be done in AS3? If you do please let me in on the secret. TIA
Image Pan - Want To Center/scale Relative To Position At Click
Hi - I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:
http://www.kirupa.com/developer/flas..._image_pan.htm
If anyone knows of a tutorial or example out there, I'd love directions to it(them). or, if you're an empathetic AS god out there, I'd love some help understanding the conceptuals. I'm new to function writing in AS, and am struggling. Thanks so much...
Scale, Center, And Move Based On Clicked Spot
So I've got this script inside of a movie clip that takes this movie clip and scales it/re-centers it. What I'd really like to do is make the center point of that movie clip be where the mouse is clicked when it scales "in".
Any suggestions?
Code:
var dubClick = "in"; // double click toggle variable
//click variables
_global.xScaleOg = container._xscale;
_global.yScaleOg = container._yscale;
_global.xLocationOg = container._x;
_global.yLocationOg = container._y;
container.onPress = function() {
if(dubClick == "in") {
new mx.transitions.Tween(container, "_xscale", mx.transitions.easing.Strong.easeOut, container._xscale, xScaleOg*2, 20, false);
new mx.transitions.Tween(container, "_yscale", mx.transitions.easing.Strong.easeOut, container._yscale, yScaleOg*2, 20, false);
new mx.transitions.Tween(container, "_x", mx.transitions.easing.Strong.easeOut, _global.xLocationOg, _global.xLocationOg-(container._width/2), 20, false);
new mx.transitions.Tween(container, "_y", mx.transitions.easing.Strong.easeOut, _global.yLocationOg, _global.yLocationOg-(container._height/2), 20, false);
_root.screen_mc.dubClick = "out";
} else {
new mx.transitions.Tween(container, "_xscale", mx.transitions.easing.Strong.easeOut, container._xscale, _global.xScaleOg, 20, false);
new mx.transitions.Tween(container, "_yscale", mx.transitions.easing.Strong.easeOut, container._yscale, _global.yScaleOg, 20, false);
new mx.transitions.Tween(container, "_x", mx.transitions.easing.Strong.easeOut, this._x, _global.xLocationOg, 20, false);
new mx.transitions.Tween(container, "_y", mx.transitions.easing.Strong.easeOut, this._y, _global.yLocationOg, 20, false);
_root.screen_mc.dubClick = "in"
}
}
Need Center Code
How do you center the swf? I forgot the code, i think it's something like fscommand...something like that. Help me out if anyone know the code to center the swf/fla, thanks.
[FLASH9- AS2] Full Screen, Keep Scale Ratio, Center Screen
[ X ] Problem solved
Hi everyone
I just came up with something i have some trouble to handle
I've tried a couple of solution but none seems to work perfectly
What I'm trying to do is simple, get my flash to go full screen, but whatever resolution the user has, my flash must centers itself with the biggest proportion possible, and two movie clips goes right and left of it, as if they were borders.
I've been able to do this with a simple png, but i was not able with a movieclip where his dimension changes through time. ( i have a tween, so the mc gets really big even though just my stage is displayed)
Help With Scale Code AS
Ive got this super simple scaling code:
mx.transitions.TransitionManager.start
(
frontBear, {type:mx.transitions.Zoom, direction:0, duration:4, easing:mx.transitions.easing.None.easeOut, param1:empty, param2:empty}
);
But this just enlarges the object from nothing. Id like to enlarge it from its current position and from 100%. So in other words if you have this icon: I want to enlarge it from its original size to a larger one. The code above starts it off from nothing...
Hope someone can help. Also its a shame you cant turn off easing when scaling with motion tween! Just doesnt seem to go off!
How Do I Center A Flash Projector? Is There Code?
I was wonder how to get my Flash Projecter exe to fire up centered when I use it from a CD ROM project?
Is there a way?
I find that every time it loads you get a new placement...some very irratating.
I have in the past used VB, and then loaded the projector inside of it, but don't want to use this method, also using full screen mode is not good either, because inside the project it needs to load outside html links, and "computer rookies" who get the cd will not know that it is loaded in behind,(is there also a way to get these outside executables to load on top of the full screen mode?) and how to get at it, and will just keep clicking the button and loading tons of windows.
code, anyone???????
Scale MC With My Move Code?
Hi All: I have this code below that moves my MC to a x-y cord on a mouse click. That works great. However, now I need modify it a bit to SCALE with the move.
OK, code on my MC:
onClipEvent (load) {
_root.targetx = -600;
_root.targety = -10;
speed = 3;
_root.onEnterFrame = function() {
_x += (_root.targetx-_x)/speed;
_y += (_root.targety-_y)/speed;
};
}
onClipEvent (enterFrame) {
if (_y == targety && _x == targetx) {
delete this.onEnterFrame;
}
}
And the code on my btn:
on (release) {
_root.targetx = -950;
_root.targety = -222;
}
Scale/Fit To Window Code
1. I have a viewable area of 400 x 400.
2. A movie clip's width and height dynamically change.
3. I need an equation that gives me the scale percentage (up or down, and proportionally) to fit the movieclip within the viewable area.
Pretty simple, but I'm terrible at math. Can someone please help?
Thanks in advance!
Edited: 04/17/2007 at 08:58:46 AM by jencarnac
Adding A Scale Up Code
How would I write a function in this code to make it so that 'target_mc' will scale up once rolled over?
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
or to scroll down once rolled out?
target_mc.onRollOut = function() {
this._alpha = 100;
};
What Is A Formula Or Code To Zoom In On The Center Of An Image...
I have 21 images, stored in an array from 0-20
some reason its different
its exactly the same until it reaches the 9th spot in the array
Now my code zoom's in nicely for 0-8, almost directly in the middle...
however the second one does not, is there a simple formula or code that can make them "both" zoom in...
and why arent all my images "Xscale" the same? (and yscale)
this trace() msg shows what's happening
Code:
Xscale 0, 234.43603515625, Yscale341.642761230469 //the first button
Xscale 1, 234.43603515625, Yscale341.642761230469
Xscale 2, 234.43603515625, Yscale341.642761230469
Xscale 3, 234.43603515625, Yscale341.642761230469
Xscale 4, 234.43603515625, Yscale341.642761230469
Xscale 5, 234.43603515625, Yscale341.642761230469
Xscale 6, 234.43603515625, Yscale341.642761230469
Xscale 7, 234.43603515625, Yscale341.642761230469
Xscale 8, 234.43603515625, Yscale341.642761230469
Xscale 9, 100, Yscale100
Xscale 10, 100, Yscale100
Xscale 11, 100, Yscale100
Xscale 12, 100, Yscale100
Xscale 13, 100, Yscale100
Xscale 14, 100, Yscale100
Xscale 15, 100, Yscale100
Xscale 16, 100, Yscale100
Xscale 17, 100, Yscale100
Xscale 18, 100, Yscale100
Xscale 19, 100, Yscale100
Xscale 20, 100, Yscale100
Center A External SWF With ExpressInstall HTML Code
Hey - ok, i know the title may not have been the best wording - but this is what im trying to do....
i want my SWF centered in the window just like in the tutorial "Full Browser Flash" now i did that for my SWF file, and it works fine. But, i cant use that HTML published file, because i created a HTML file for my ExpressInstall Flash Player... i tried to set the <div> tags to center, but its not reading it.
Does anyone know how to merge my SWF HTML with my ExpressInstall HTML? (The ExpressInstall HTML is the one thats live on the site: http://www.braytongraphics.com/newbranding/loader.html)
Heres my SWF code:
Code:
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
<p align="center"><font face="HelveticaNeue LightExt" size="36" color="#909295" letterSpacing="1.000000" kerning="0">Brayton Graphics</font></p>
-->
<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="loader" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="loader.swf" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="bgcolor" value="#ffffff" /><embed src="loader.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="100%" height="100%" name="loader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
And heres my ExpressInstall Code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Brayton Graphics</title>
<!--<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" media="all" title="mainStyles" href="styles.css" />-->
<script type="text/javascript" src="swfobject.js"></script>
<style type="text/css">
body {
background-color: #ffffff;
font: .8em/1.3em verdana,arial,helvetica,sans-serif;
}
#info {
width: 300px;
overflow: auto;
}
#flashcontent {
width: 850px;
height: 600px;
float: left;
margin: 15px 20px;
}
</style>
</head>
<body>
<div id="flashcontent">
<div id="container">
<p class="warning">Please install the current version of <a href="http://www.macromedia.com/go/getflashplayer/">Flash Player</a> to view this site.</p>
</div>
</div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("loader.swf", "Brayton Graphics", "100%", "100%", "8", "#fff","true");
so.addParam("scale", "noscale");
so.addParam("align", "tl");
so.write("flashcontent");
// ]]>
</script>
</body>
</html>
Any help on merging these two is grately appreciated
thanxs :)
Code For Uniform Scale To Fit Area
I'm making an image gallery that loads external jpeg's. The area I need the images to fit into is 622*324 pixels, but the images I'll be loading will be mostly larger than this. What I need to do is scale down the image container on import so it fits inside the area, but still retain the original image aspect.
Does anybody have a snippet of code I could use? I'm having trouble with the logic.
thanks
mark
MX2004
More Help With Code For Transforming Scale And Color...
Here is some code I'm trying to finish. It does two things: Fades the color of a movieclip to another color, and scales (increases the width) the rectangular movie clip - all of this I figured out with the help of some very nice folks on this forum, so thanks!
The code works, the mc resizes and fades to the desired color, BUT I need the movieclip to scale back (decrease in width) once it reaches it's target width of 400.
I've tried a few things, but uh, not quite finding it...any ideas? Thanks again! Here's the code:
// mc_retangle contains a black retangle...
var mycolor = new Color(mc_retangle);
var change = {rb:169,gb:195,bb:217};
mycolor.setTransform(change);
button.onRelease = function() {
// scale movieclip
mc_retangle.onEnterFrame = function(){
if ( mc_retangle._width<=400) {
mc_retangle._width += 40;
} else {
delete this.onEnterFrame;
}
}
// fade color
//varibles to mix desired color
var red_dest = 219;
var green_dest = 201;
var blue_dest = 174;
onEnterFrame = function(){
//change red//
if (red_dest>=change.rb) {
if (change.rb<red_dest) {
change.rb += 3;
}
} else {
if (change.rb>red_dest) {
change.rb -= 3;
}
}
//change green//
if (green_dest>=change.gb) {
if (change.gb<green_dest) {
change.gb += 3;
}
} else {
if (change.gb>green_dest) {
change.gb -= 3;
}
}
//change blue//
if (blue_dest>=change.bb) {
if (change.bb<blue_dest) {
change.bb += 3;
}
} else {
if (change.bb>blue_dest) {
change.bb -= 3;
}
}
mycolor.setTransform(change);
}
}
Code To Scale A MC On Stage To Half The Size..
Hey,
I need a action code to put on a mc that I got made, so scale the whole movie clip so it plays at 50% of the size, or 20%, so I can play about with the size to fit it in right.
Thanks,
Ian
Code To Scale Vertical Images In PhotoGallery
Hello!
I'm working with this tutorial:
http://www.kirupa.com/developer/mx/photogallery.htm
I'm trying to figure out how I tell the clip to scale the dynamically loaded images to fit. For example, I have mostly horizontal images -- no problem, the clip is set up right. Now, If I come across a vertical image-- the image doesn't scale, but instead just slops out of the MC.
I'm just trying to figure out the actionscript to get it to dynamically scale, if thats even possible?
thanks so much!!!
-MD
Code To Scale Vertical Images In PhotoGallery
Hello!
I'm working with this tutorial:
http://www.kirupa.com/developer/mx/photogallery.htm
I'm trying to figure out how I tell the clip to scale the dynamically loaded images to fit. For example, I have mostly horizontal images -- no problem, the clip is set up right. Now, If I come across a vertical image-- the image doesn't scale, but instead just slops out of the MC.
I'm just trying to figure out the actionscript to get it to dynamically scale, if thats even possible?
thanks so much!!!
-MD
Scale Movieclip - It Works But The Scale Handle Wont Be Dragged Correctly
hi,
because I need to get a movieclip dynamically scaled I have the following script. But the problem is that the handle wont stay at the right bottom corner. I think it has to do something with the math function but I dont know exactly what.
ActionScript Code:
attachMovie("Pic", "thePic", 1);
thePic.onEnterFrame = function(){
this._width = this._height = container.handle._y+25;
}
scrollArea = Math.sqrt(Math.pow(thePic._height,2) + Math.pow(thePic._width,2));
createEmptyMovieClip("container",2);
container._x = 50;
container._y = 50;
container._rotation = -45;
container.attachMovie("scale_handle", "handle", 2, {_y:scrollArea});
container.handle._alpha = 0;
// all mouseactions of the handle
container.handle.onPress = function(){
this.startDrag("true",0,0,1,scrollArea);
trace(scrollArea);
trace(thePic._height);
}
container.handle.onMouseUp = function(){
this.stopDrag();
container.handle._alpha = 100;
}
container.handle.onRollOver = function(){
container.handle._alpha = 100;
}
container.handle.onRollOut = function(){
container.handle._alpha = 0;
}
// all mouseactions of the picture
thePic.onPress = function(){
_root.startDrag();
}
thePic.onRelease = function(){
stopDrag();
container.handle._alpha = 100;
}
thePic.onRollOver = function(){
container.handle._alpha = 100;
}
thePic.onRollOut = function(){
container.handle._alpha = 0;
}
maybe you could help me.
thanks in advance, ckey
MVC: Anyone Actually Implementing It?
Do any of you actaully implement the MVC pattern to build sites? I'm intersted in how one goes about it.
I don't need concrete code examples, but more how you went about separating the layers of the pattern.
Thanks.
Implementing
helle there,
I have a swatch of little lines that each have their specific position and I need them to avoid the mouse head when it passes through, then come back to their original position. (and be repeated over a whole page, creategrid or something?)
I found the following code, but having avoided AS for as long as i could, i have no idea how to implement it ...
http://www.senocular.com/pub/flash/ParticleBehavior.as
http://www.senocular.com/pub/flash/P...avior_doc.html
Could someone have a look or otherwise have the grandeur of giving an idea on how to acheieve this???
Thnk you!
Keeping The Center Of The Stage In The Center Of A Web Browser
Hey,
I have a really wide flash page, but the main portion of it is in the center
of the .swf. My question is how do I make the center of my .swf in the center
of a web browser so that when the user resizes the browser, the center of the stage stays in the center of the browser? Right now it has the left side of the .swf aligned with the
left edge of the browser so the center of my .swf is usually being cut off by
the right edge of the browser and users have to scroll to the right to see the
main portion of the site...I'm sorry if that's somewhat confusing, but any help
at all would be appreciated. Thanks!
Dave
How Do I Center An External File In The Center On The Stage
I followed the tutorial for preloading external swf files, now that I have done so and it works, I notice that the swf file does not center after I preview it after it loads the external file.
I have centered the holder on the stage but after I preview the file or test movie, the loaded file is not centered and I have to play around with it for it to be centered. Is there a way to set the x and Y in the actions so this won't happen or do I have to know the size of the file that I am preloading off my server?
Implementing Screensaver
I have a presentation file called presenation.swf which i converted into presenation.exe . i have another file called screensaver.swf .
what i want is when the presentation is in use and the mouse is not used for say 1 minute then the screensaver file should start playing and when the mouse is moved it should come back to the presentation(like a windows screensaver).
what code should i use in the presentation flash file.
Implementing A Timer
The code below is used to manipulate some graphics.
MaxScore = 478-(Total_Score*14);
CurrentScore = getProperty("_root.ScoreBox", _y);
while (CurrentScore > MaxScore) {
CurrentScore=(CurrentScore-1);
setProperty("_root.ScoreBox", _y, CurrentScore);
}
This works properly, but it all happens too fast. SO I want to slow it down, I guess by using a timer to effectively achieve the following:
MaxScore = 478-(Total_Score*14);
CurrentScore = getProperty("_root.ScoreBox", _y);
while (CurrentScore > MaxScore) {
CurrentScore=(CurrentScore-1);
setProperty("_root.ScoreBox", _y, CurrentScore);
"pause for 20 milliseconds"
}
How is it best to go about this?
SEO And Implementing Detection
i am using the detection kit from adobe and i am just about to rename the detection script "index.html" which then takes you to the "site.html" file if
everything is cool. my question is am i messing with the search engines
by pushing the site down one level ? should i put all the meta-stuff on the
detection page which is now named "index.html"?
[F8] Implementing Proximity
I'm trying to get some movie clips to duplicate from a single point on the stage and with each iteration I want them to move further away from the start point. This way thay can cover the whole stage and unmask the entire image below.
I sort of have it working with this code, however I think I have some of the math wrong or something because they duplicated movieClips never cover the entire stage. Can anyone poini out my error in the code below?
Code:
var intervalId:Number;
var duration:Number = 50;
var prox:Number = 5;
var control = prox;
var count:Number = 1;
var maxCount:Number = 17;
var startX:Number = 400;
var startY:Number = 200;
var xMin:Number = 0-startX;
var xMax:Number = 500;
var yMin:Number = 0-startY;
var yMax:Number = 280;
function executeMasking():Void {
_root.mcMask.mcItem._x = startX;
_root.mcMask.mcItem._y = startY;
for (i=1; i<=count; i++){
n = i*count;
randomX = (Math.round(Math.random()*(xMax-xMin)/prox))+(startX/2);
randomY = (Math.round(Math.random()*(yMax-yMin)/prox))+(startY/2);
orgClip = "mcMask.mcItem";
dupClip = "mcMask.mcItem"+n;
clipDepth = mcMask.getNextHighestDepth();
mcMask.mcItem.duplicateMovieClip(dupClip, clipDepth,{_y:randomY, _x:randomX});
}
if(count >= maxCount) {
clearInterval(intervalId);
trace("cleared");
}
if(control>count){
prox--;
}
count++;
}
intervalId = setInterval(this, "executeMasking", duration);
[F8] Implementing A Class
I'm teaching myself to write some basic AS2 classes. I hope my question won't seem too naive... Here goes:
I've written a decent little movement class called "slider".
The slider class extends movie clips and has a method called "startMovement".
My question is, is there any way to apply the startMovement method to to movie clip instances without using symbol linkage in the library?
If I use symbol linkage and export for AS and associate each clip with my class, it works fine. But what if I want to apply the method to dynamically created clips?
Or else, what if i want to apply the method on lots and lots of instances? Is there a way to write my code in the FLA or in the AS file so that it applies to any and all movie clips?
Thanks!
Help Implementing A Function
Hi I need to make a function which tests if some conditions are met, and if they are, some code that you write when calling it will be executed. For example: (when the function is called it should look like this)
Code:
myFunction (x) {
//code here
}
Any help will be appreciated.
Thanks
Implementing Interface
I apologize in advance for the newbie question. Is it possible to have my flash file implement a top level interface. I am trying to create component in flash and I would like to define an interface which it will implement but i'm not sure where I would even add in the implement statement in flash.
Implementing Speech
Hi All,
I have developed an application in flash which will retrieve some text from database and ill display it in a text box. As the same i want to make an image to speak the text which is coming from database. Please help me in this regards
Advance Thanks
Hariharan.S
Implementing .swf File Through Css
I was wondering how can I implement a Flash movie through a CSS file? I'm doing a friend a favour with his site, but the person who original made the site for him did it mostly through CSS and Divs. I'm lost, confused and not too familiar with this, can someone help me
Here's the coding from the CSS file:
#header-wrapper #header {
width: 698px;
height: 68px;
background: url(images/home/header.gif) no-repeat top left;
padding: 0;
margin: 0;
text-indent: -1000px;
}
Thank you in advance
Implementing Javascript
Hello. I have a flash site I am currently working on and I got stumped what to do on my portfolio page. I would really like to take this script into flash but I am a bit clueless how to.
Click the thumbnails under Demo 2-
http://www.dynamicdrive.com/dynamici...box2/index.htm
|