ActionScript Generated Animation
Hello everyone, I'm new here, which I'm sure you've guessed.
I would like to create an animation similar to the one on the http://kirupa.com homepage for "Check Out the Winning Entries"; that being circles that move randomly by actionscript (I'm assuming that is how it's done, otherwise feel free to correct me).
Can anyone volunteer a snippet that could set me on the right track to accomplishing this, or point to a tutorial for it? Once I get going I'm usually pretty good, but learning ActionScript has actually proven quite difficult.
Thank you, and I hope to contribute in some fashion to this site as soon as I know what the heck I'm doing
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 08-16-2004, 07:31 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ActionScript Generated Animation
Hello everyone, I'm new here, which I'm sure you've guessed.
I would like to create an animation similar to the one on the http://kirupa.com homepage for "Check Out the Winning Entries"; that being circles that move randomly by actionscript (I'm assuming that is how it's done, otherwise feel free to correct me).
Can anyone volunteer a snippet that could set me on the right track to accomplishing this, or point to a tutorial for it? Once I get going I'm usually pretty good, but learning ActionScript has actually proven quite difficult.
Thank you, and I hope to contribute in some fashion to this site as soon as I know what the heck I'm doing
Rewind AS3 Generated Animation
Hi,
I'm having some problems rewinding a actionscript 3.0 generated animation. I have a MC that I want to expand when you mouse over it. Whenever you roll out the animation it should play backwards and stop at the beginning.
This is my code as it looks now:
Code:
import fl.motion.Animator;
var boxani_xml:XML = <Motion duration="15" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>
<Source frameRate="12" x="274.95" y="100.95" scaleX="0.589" scaleY="0.473" rotation="0" elementType="movie clip" instanceName="largeBT" symbolName="9slicebutton">
<dimensions>
<geom:Rectangle left="-175" top="0" width="350" height="299.95"/>
</dimensions>
<transformationPoint>
<geom:Point x="0.5" y="0.49991665277546254"/>
</transformationPoint>
</Source>
</source>
<Keyframe index="0" tweenSnap="true" tweenSync="true">
<tweens>
<SimpleEase ease="0"/>
</tweens>
</Keyframe>
<Keyframe index="14" x="-0.05000000000001137" y="99.95" scaleY="2.41014799154334"/>
<Keyframe index="20" x="-0.05000000000001137" y="50.95" scaleY="1.41014799154334"/>
</Motion>;
var boxani_animator:Animator = new Animator(boxani_xml, boxani);
var rewind:Boolean = false;
boxani.addEventListener(MouseEvent.ROLL_OVER,menuDown);
boxani.addEventListener(MouseEvent.ROLL_OUT,menuUp);
function menuDown(e:MouseEvent):void{
boxani_animator.play();
rewind = false;
}
function menuUp(e:MouseEvent):void{
rewind = true;
}
this.addEventListener(Event.ENTER_FRAME,revFrame);
function revFrame(e:Event):void{
if(rewind == true){
boxani_animator.prevFrame();
}
}
When running the code, I get the following error message:
Code:
1061: Call to a possibly undefined method prevFrame through a reference with static type fl.motion:Animator.
Is there anyone out there who could point me in the right direction here? I've googled my eyes out but I could not find any good information for a beginner like me.
Thanks!
/Laserkatt
edit: I should mention that I'm using CS3.
Random Generated Animation
Hi
Im trying to create a button that loads a random jpeg from file (I know how to do this.) and places it in a movie clip on a specific frame in its time line. Then when I click the button again it randomly selects another jpeg (but not the same one) from file and puts it into the next frame of the same movie clip.
The end result will be a randomly genetayed animation, which sounds like fun.
Any ideas
Cheers
Masking Actionscript-generated MC's
is it possible to mask actionscript generated mc's?
I duplicated a whole bunch of mc's randomly and i would still like tocontain them using a mask...is this possible?
Audio Generated By Actionscript?
this question/challenge is inspired by the 25 lines actionscript contest.
i was thinking it would be neat to do an audio entry. but i think there is no way to generate audio using only actionscript. am i wrong?
can we fool the player into playing image data?
Actionscript-generated 3D, Adding Images
Hi,
Am working on a project a bit beyond my capabilities, which is basically a modified version of one of senocular's (from Kirupa) 3D button cube tutorial.
After getting each face to work independently and loadmovie onclick, I am struggling to add an image within each face on the cube. The FLA is attached, I would be very grateful to anyone who can lead me in the right direction or explain the solution - Maths/Physics expert required!
Actionscript Generated Reactive Navigation
Hi All,
I'm trying to create a menu simliar to the one used in this template:
http://www.templatemonster.com/flash...ates/7161.html
I have seen menus like this in multiple places, but have never seen any tutorials or explanations on how exactly it is done.
The version I'm trying to create would have the end opposite the option rooted in place. I think that would go a long way towards usability. Anyone seen any explanations on things like this? Thanks!
Luke
Actionscript Generated Brushed Metal
Brushed Metal jpg texture
Brushed Metal - Flash 8 Version
This is the brushed metal texture I would like to be able to generate with code for Flash 6 AS2.0. The Flash 8 version is perfect, simple and done but I would like to make this Flash 6 compatible. Advertising publishers really aren't into pushing the boundaries.
This was created in Photoshop:
C0C0C0 bkgd
Monochromatic Gaussian Noise 15%
Motion Blur 170
Set layer to Color Burn
Place a 20% blackto-white gradient on top
Place metal color layer underneath
The Flash 8 version is created with this code:
Code:
Stage.scaleMode = 'noScale';
this.createEmptyMovieClip("static_mc", 1);
static_mc._x = mask_mc._x;
static_mc._y = mask_mc._y;
var bmp = new flash.display.BitmapData(mask_mc._width, mask_mc._height);
static_mc.attachBitmap(bmp, 1);
static_mc.setMask(mask_mc);
var grayscale = true;
bmp.noise(Math.floor(1000*Math.random()), 50, 200, 1|2|4, grayscale);
I'm not sure what my approach should be, in terms of particle generation. What I'm looking at at the moment, is to hand build something close, and tile it.
Not very re-usable or cool.
Any thoughts suggestions or links gladly received...
cheers,
MM
Exporting Information Generated By Actionscript
hi there,
i'm working on a project where I am generating shapes and patterns using the drawing api.
there is an example of the simple code i'm using below.
the code i'm using is working out fine and producing the results I want but I was wondering if there was a way of exporting the generated shapes into something like illustrator. Now I realise I could add tracers and get the numeric values in the output but I wanted to know if theres an easier (and hopefully graphic) way saving or exporting this information. I have already started to make this interactive, with the limiting values controlled by sliders and whatnot but I really need to be able to "save" their output.
the next stage after this is implementing isometric 3d, and I was also wondering if their was a way of exporting flash information that was generated with actionscript to a .3ds file (this I know would be pretty complicated but I thought it might be possible to get some 3d information from the output and convert it)
there is a lot of discussion about how to get information into flash, but not much concering how to get it out, is the general solution to my problem using the output dialog and generating xml?
thanks in advance, christopher
sample code
Quote:
_root.createEmptyMovieClip("walkway",100);
walkway.lineStyle(40,0x336699,100,false,true,"squa re","miter",50)
walkway.lineTo(0,250);
dupMovie2 = function () {
for (i=10; i<30; i++) {
walkway.duplicateMovieClip("walkway2"+i, i, {_x:500+(Math.ceil(Math.random()*4)*150), _y:20+(Math.ceil(Math.random()*3)*150), _alpha:100});
with (eval("walkway2"+i)) {
_rotation=Math.ceil(Math.random()*4)*90;
}
}
};
dupMovie2();
walkway._visible = false
Animate Actionscript Generated Clips
I'm trying to make a few modifications to the Kirupa XML slideshow here:
http://www.kirupa.com/developer/mx2004/thumbnails.htm
I've removed the scrolling, and would like the thumbnails to animate X position when they load; starting off stage and moving on.
I'd also like a black border around the thumbs to appear on Rollover/Click...I have an idea on how this should work, but having trouble implementing it...I'm guessing I'd have to attach another movieclip behind each thumb and set visibility of that clip on rollover.
Any help would be greatly appreciated. Here's the code I'm using with the attempt at animation.
Code:
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_right._x-(target_mc._width+5)*k;
/* begin anim
targX = "thumbnail_mc.t"+k._x;
cX = "thumbnail_mc.t"+k._x-1000;
difX = cX-_root.targX;
setProperty("thumbnail_mc.t"+k, _x, cX-(difX/5));
// end anim */
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
//thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
Convert Text Generated By Actionscript To MC/Button
Hi.
I have a actionscript which sets the GameEndTx to a special message based on performance.
GameEndTX = "Nicely done! Now go and claim your prize";
I want to make this text clickable so you can claim your prize with a simple click on the text. For that I think I need to make it a mc/button.
Hopefully someone can help me with this!
Can Global Unique Identifiers Be Generated Through Actionscript?
Hi there,
I have a flv player that I have built and I have used the netstream class to send data viewed back to a mySQL database. What I would ideally like to do is each time a swf containing the player is loaded; a unique ID is generated for that particular viewing! This way all the data that gets send to mySQL regarding playback can be assigned a unique ID.
Any thoughts?
Regards
Jon
Inserting Dynamic Text On A 3D Cube Generated Through Actionscript
Hi,
can anybody help me in developing a 3D cube in flash using actionscript and inserting dynamic text on each face of the cube.
I have downloaded a flash file from the cleverpig flash tutorial which generates the 3D cube through actionscript but I want to know how the dynamic text to be inserted on all the 6 faces of the cube which should be fetched from an XML file. and in this file the faces are not made opaque(alpha 100) pls let me know how to make all the faces opaque. when I tried to make 30% to 100 only one face is taking it not all the faces. pls help me
if you have any other flash file related to this pls send it across.
Create A Movie Clip From Actionscript Generated Objects
I am trying to mask an area with actionscript generated boxes. I know that the only way to do that is to make it a Movie Clip, but I can't seem to be able to do that. I am really stumped on this. I really need someone to show me how to make this a movie clip. Any help would be greatly appreciated.
Create A Movie Clip From Actionscript Generated Objects
I am trying to mask an area with actionscript generated boxes. I know that the only way to do that is to make it a Movie Clip, but I can't seem to be able to do that. I am really stumped on this. I really need someone to show me how to make this a movie clip. Any help would be greatly appreciated.
Timeline Animation Tweening Vs Actionscript Animation
Hi All.
The reason for this title is because I am currently producing flash banners for a company and have been looking all over the internet on such a subject.
My flash skills are somewhat limited. I currently make everything on the timeline and have started to see its limits. I find I am getting choppy movement with some of my animations.
I have tried using jpgs, pngs, gifs and vectors in flash but still get the same problems. I have tried setting the fps to 12, 24, 32 and 90.
I hear that flash 8 is apparently buggy and that you should set it to 31fps. Can anyone verify this?
Also I understand by uping the fps you start to encounter loading problems as you are starting to reload the whole piece your working on faster and faster and so computers with a low cpu will suffer.
I found by looking at using certain colours one can get around possible chopping problems and by spinning the word or image this can take away some of the effect.
I also read by setting publish to 'quality=best' can make a difference.
Next I've started reading about 'onEnterFrame' 'pressHandler' and OnMouseMove handlers in actionscript and how this can help.
Can anyone shed any light about how to get a nice simple smooth animation for a flash banner?
Many thanks
Newsense
Changing Keyframed Animation Into Actionscript Animation
Can anybody provide me with any code and technique that will succesfully allow me to convert my menu from a keyframed animation into a dynamically generated actionscript menu? I just realized that i might have to change the buttons more often than not and i would like to future-proof this as much as possible. i also want it to move very smoothly. Any and all help is appreciated
Here is the menu animation
P.S.: some of the buttons are to be drop down menus, so id like that functionality as well. Any and all help is appreciated. Thanks alot
Changing Keyframed Animation Into Actionscript Animation
Can anybody provide me with any code and technique that will succesfully allow me to convert my menu from a keyframed animation into a dynamically generated actionscript menu? I just realized that i might have to change the buttons more often than not and i would like to future-proof this as much as possible. i also want it to move very smoothly. Any and all help is appreciated
Here is the menu animation
P.S.: some of the buttons are to be drop down menus, so id like that functionality as well. Any and all help is appreciated. Thanks alot
Changing Keyframed Animation Into Actionscript Animation
Can anybody provide me with any code and technique that will succesfully allow me to convert my menu from a keyframed animation into a dynamically generated actionscript menu? I just realized that i might have to change the buttons more often than not and i would like to future-proof this as much as possible. i also want it to move very smoothly. Any and all help is appreciated
Here is the menu animation
Roll over the cross to start it.
P.S.: some of the buttons are to be drop down menus, so id like that functionality as well. Any and all help is appreciated. Thanks alot
Changing Keyframed Animation Into Actionscript Animation
Can anybody provide me with any code and technique that will succesfully allow me to convert my menu from a keyframed animation into a dynamically generated actionscript menu? I just realized that i might have to change the buttons more often than not and i would like to future-proof this as much as possible. i also want it to move very smoothly. Any and all help is appreciated
Here is the menu animation
Roll over the cross to start it.
P.S.: some of the buttons are to be drop down menus, so id like that functionality as well. Any and all help is appreciated. Thanks alot
ActionScript Animation VS. Timeline Animation
I learned ActionScript Animation before Timeline Animation. I feel comfortable using either one but I was just wondering... which is the better method to use?
I noticed the timeline animation is smoother than AS Anim. Is this common place?
Actionscript Animation Vs. Timeline Animation
So I just got finished watching lees tut on the new motion editor in CS4, it looks pretty sweet!!! As I was watching a few questions came to my mind. Please keep in mind I have only been in the flash world for about a one and a half years and still trying to wrap my brain around AS2.
As I have been learning actionscript I have always been under the notion that it has been better to script your animations rather than do timeline animations. While I understand that would be good for a 10-15 second web banner I never understood how you could script a 2 min animation so I always animated in the time line.
So now with the new motion editor and say the bone tool in cs4 my question now is when should you script your animations and when do you use the timeline?
Thanks,
Mike
Using Actionscript For Animation
Hi!
A lot of people say that using actionscript to animate a flash movie makes the flash smoother and faster, instead of using good ol' tweening tools. All the actionscripts tutorials that I see on some sites are only things like mouse trailers. Can someone please tell me how to animate things with actionscript (move object, hide, show... ya know basic things) or a good tutorial could be cool
Thanks
Animation Using Actionscript.
Hi! I'd like to know how to animate a symbol using actionscript. The effect I am looking for is a symbol moving in from the left of the stage and then slowing down as it reaches the right hand of the stage and finally stops at the right. I would appreciate it if someone can help me in detail or point me to a tutorial.
Animation Through Actionscript?
I'm new to actionscript and I was wondering if people make their animations entirely with actionscript. If not, do you use motion tweens? A lot of my favorite sites have intros that have animations that run so smooth. Any help would be nice. Thanks.
Actionscript Animation
when you make animation with tweeing it is very easy to make this thing but i need to do it with actionscript, i want my pictures to alpha from 0 to 100
I used this but it is no good, what to do??
while(a<25) {this.evoje._alpha=4*a;a++;}
AS gurus please help!!!
3D By Actionscript/animation
Is there any possibility to create a 3D-object with a texture that interacts with the movements of the mouse (excuse my english), like if I have some water (3D) and if I click on it, waves appear? The point is, I donīt want to have one wave-animation, that always repeats, I want to have waves anyway, and the wave of the mouseclick has to interact with the other waves?
Or if I want to have waves by mouse-moves, the faster the mouse, the higher the waves?
Its not to easy, I think, you could help me with every tip or trick that works with similar problems.
Thanks a lot.
Animation Through ActionScript
How do you animate a movie clip without using the tweening process. i.e.: if you click the button, the movie clip should animate from right to left.
Animation With Actionscript, How Is Than Done?
Ok, I have looked but I suppose I don't know what I am looking for. I want to find a way to move a few symbols across the screen @ different speeds and do it with out laying out a long time line.
I want to do it with X and Y points but I don't know how. Does anyone know if there is a tutorial I could check out or a movie I could download to check the process out??
Thanks for any help!!
Flash Puma
-if a puma won't eat it neither will i
Animation With Actionscript?
i need to move a circle on the stage from left to right...pretty dumb hu?....but i want it to move with ActionScpt. and how to control the speed...i just want when the movie runs...it moves from left to right...or viceversa..
after i have the circle in a MC and the MC on the stage with an instance name give...whats the next thingy?
Animation With Actionscript
Anyone know any good places i can look, or any good books that i can get on actionscript that will help me animate,interact, and change alpha with my flash projects?
Thanks all, have a great day
Animation Through Actionscript. Help
Hey guys, I'm not a programmer, but I'm interested in learning how to go about animating using action script. In particular, I'd like to know how to do things like accelerating objects, decelerating objects and even having something start at point a, ease in and then ease out as it approaches point b. That would be great. I can do this through motion tweening, but I just find that +/-100 just isn't enough of an ease. I like for things to really speed up and then really slow down. The equivalent of easing in or out to the value of 200 or 300 in the tweening controls. So could anyone help me out. Are there tutorials on this.
To summarise, I'd like to know how to have an object move from point a(50,50) to point b(400,400) using actionscript. I'd like to know how to adjust the acceleration and deceleration between these points. Preferably both. That is, Easing in from point a and then easing out as it approaches point b.
Again, I am not a programmer and code is really scary to me, so if you could highlight important parts of the code that I need to modify, that would be great. And just a simple description of what each line of the code does if you have time.
Thanks alot. much appreciated.
Actionscript Animation
Greetings.
Here's an easy Q:
I have 10 objects on 10 layers I need to animate for the length of the movie in a simple appear/disappear fashion. I need to animate in a certain sequence. I should be able to do this with actionscript using only 1 or two frames i.e. turn on frame 1 of layer, turn off frame of layer etc. Something like that.
I want to keep the file size down and hopefully not have to run numerous key/empty frames.
I hope someone can help.
CHEERS!
Actionscript Animation
I have 4 buttons in a movie clip and I want to be able to have a red bar move over whichever button the mouse is over.
Any help would be greatly apprecieated.
PS it must be animated
Actionscript Animation
Okay...I know that once I post this, I'm going to look like an idiot, because I am certain that I'm missing something insanely simple here. Laugh if you must...just don't hurt yourself.
I'm have 5 links, evenly spaced going up/down the left hand side of my page. When I mouse over one of these links, there is a sponge that moves up and down so it's sitting on the left of the link. There is a slight delay in the sponges movement, and a slight bit of viscocity involved, but that's not important.
What I am trying to do is this: Whenever someone clicks a link, I want my sponge to "scrub" back and forth over the links. This may sounds strange, but it's for a cleaning lady's website...and that's what she wants...
Right now I have the following actionscript in the links:
on(release){
sponge._x = sponge._x + 10;
if (sponge._x>=170){
sponge._x = sponge._x - 10;
}
}
The sponge moves 10 pixels (?) per click, and does not move back. What am I doing wrong? Am I just an idiot, or is this actualy something difficult and I'm just not realizing it yet.
~bs~
Actionscript Animation Help
please check out the following
wheeler
what i am trying to acomplish is that when i move this little rolling guy i named wheeler.
i want his wheel to roll the apropritate amount to what ever i move him left and right.. via
a motion tween or whatever.
i think it will be something like.. rotate wheel +1 when ever x moves..
im very new to action scripting.. but im learning.
i cant wrap my head around this home you can help me out.
Animation Via ActionScript (PLEASE HELP)
Hi Everyone,
I am trying to move a box around multiple_ times with AS. I have it working with buttons, I want it to move just like I have with on buttons. How do you move it when the first action is done. Here is the link:http://www.dyaddesigns.com/move/move.htm
I hope that this make sense
Thanks!!!!!
Animation Through Actionscript
Hi folks
I'm new to the board so I hope this question isn't too simple.
I'm trying to do more animation using actionscript in Flash MX. I've found some script that use an instance property to move a clip. For instance:
onClipEvent (enterFrame) {
speed = 10;
this._rotation += speed;
}
I'm wondering if there is an easy way to tie this to a rollover or mouse click. Is it possible to set a continuous property change using a mouse event?
thanks
Actionscript Animation Help
Hello all, I am hoping someone can assist me. What I am trying to do is animate a MC on a button click using actionscript rather than tweens, if possible. Example: On buttonclick, the MC will move back and forth (as in a hammer striking a nail). I was able to get rotation to work, but cannot figure out how to do this.
I am using Flash MX by the way.
Any assistance will be greatly appreciated.
Cheers!
Using Actionscript For This Animation
Hey All,
I've got this flash piece (MX 2004) where I'm cycling a series of images across the screen. There are X number of them, and I'd like to vary the interval at which they move across the screen.
What would be the ideal way to do this with AS? Something along the lines of setting a random interval, looping through and displaying each image at a different interval ..
Any suggestions?
Thanks.
Using ACTIONSCRIPT For Animation
hey guys i have a movieclip that I want to basically do a motiontween but I want to use action script to do it. This is what I have right now:
nextmovie=_root.content_tour.container.container2. attachMovie("tour_block", "tour_block"+whichdepth, whichdepth);
nextmovie._width = 0;
for (s=0; s<220; s++){
nextmovie._width = nextmovie._width + 1;
}
and instead of showing the animation progress it just shows the end result... wondering if anyone could help me out with this-
-alex
Actionscript Animation Help
Hi, I'm wanting to animate this:
http://www.heiseman.com/temp/test.gif
It looks like actionscript is a good solution. I usually do this by hand, but it looks too complex. I'd like for all the arrows to follow an S curve from top to bottom but in an organic and loose way. They can differ from the curve and some can be slower or faster than others. Any ideas how to do this?
Thanks alot!
[F8] Animation Using Actionscript
Hi,
Not sure whether to have this post here or the Flash Newbies section. Sorry ahead of time.
Anyway, I'm working on an animation. The 'red balls' enter, breaks up and bounces around the stage. What I want to do is to have all those balls stop (when the user clicks) and move to the center of the stage. I was wondering if it was possible to do this using actionscript? The red balls are coded to move around randomly.
Here's the SWF file:
Animation SWF
So right now, when you click, the balls just stop...but I know if I enter
this._X = 400;
this._Y = 300;
in the onClipEvent (mouseUp) part of my code, all the balls will be placed in the center. So I was wondering if there a way to have the balls stop and actually have them all MOVE towards the center?
Each ball is a movie clip and I'm using this code to control all the balls:
code: onClipEvent (load) {
speed = 25;
angle = random(360);
speedX = Math.cos(angle*Math.PI/180)*speed;
speedY = Math.sin(angle*Math.PI/180)*speed;
}
onClipEvent (enterFrame) {
this._X += speedX;
this._y += speedY;
if (this._X>=760) {
speedX = -speedX;
} else if (this._X<=15) {
speedX = -speedX;
} if (this._Y>=560) {
speedY = -speedY;
} else if (this._Y<=15) {
speedY = -speedY;
}
}
onClipEvent (mouseUp) {
speed = 0;
angle = 0;
speedX = 0;
speedY = 0;
}
Hope I explained my problem clearly!
Thanks.
[F8] Actionscript And Animation
Do any of you know any good documentation/tutorials on the actionscript for flash 8?.......
Also
Do you know any good sites/tutorials on flash animation
Thanks in advance
Help With Animation Using Actionscript
hi everyone,
Im currently working on this flash project and I wanted to use actionscript to create looping animation. Can anyone teach me or point me to a tutorial that shows how to make simple looping animation using actionscript CS3? Thank you in advance and more power to this community.
Thanks,
Louie
Animation Via Actionscript
hi,
I've a problem with animation via actionscript relating the tutorial http://www.actionscript.org/tutorial...t/index2.shtml.
What i want to do is: I want a square with 80x80 px to grow to 80x350 px when i click a button. Since I never did animations with actionscript before i followed the tutorial.
So I put this code on the square:
onClipEvent (load) {
_root.targXscale = 80;
_root.targYscale = 80;
}
onClipEvent (enterFrame) {
cXscale = this._xscale;
cYscale = this._yscale;
difXscale = cXscale-_root.targXscale;
difYscale = cYscale-_root.targYscale;
setProperty(this, _xscale, cXscale-(difXscale/5));
setProperty(this, _yscale, cYscale-(difYscale/5));
}
and this on the button:
on (release) {
_root.targXscale = 350;
_root.targYscale = 80;
}
The animation itself works fine, but the result is that the square is smaller than 350 pixels. Its about 200 something... This is probabely because the difXscale variable is devided by 5 in the setProperty line.
I figured out that if I enter 438 px instead of 350 px in the targXscale var it works and the square is 350 px after the animation instead of 200something when entering 350 into the targXscale value. So you have to multiply the pixels you want with 1.25 to get the real result. E.g. 350*1.25 = 437.5
The problem is, that it is very imprecise. Can anyone help me with this. I mean i just want the square to grow bigger, can't be to hard...
thx joe
Animation Via Actionscript
hi,
I have a litte problem. I want a square to grow form 80x80 pixels to 80x350 pixels by the click of a button. Since I never did animations with action script i followed this tutorial: http://www.actionscript.org/tutorial...t/index2.shtml
So my square has the action:
Code:
onClipEvent (load) {
_root.targXscale = 80;
_root.targYscale = 80;
}
onClipEvent (enterFrame) {
cXscale = this._xscale;
cYscale = this._yscale;
difXscale = cXscale-_root.targXscale;
difYscale = cYscale-_root.targYscale;
setProperty(this, _xscale, cXscale-(difXscale/5));
setProperty(this, _yscale, cYscale-(difYscale/5));
}
and the button this one:
Code:
on (release) {
_root.targXscale = 350;
_root.targYscale = 80;
}
The animation itself works fine but in the end the square isnt 80x350 pixels but about 64x280 pixels. This is probabely because the difXscale variable is devided by 5 in the setProperty line. So if I enter a value of 438 in the targXscale var and a value of 100 in the targYscale var of the button it works almost perfect.
But is this guessing of numbers the only way to get the right size in the end? I hope not... Hopefully someone of you can help me with this, because the results are very imprecise by using this method.
thx 4 help joe
Actionscript Animation
Hullo, all
here is a simple animation I wrote. 5 duplications of moive clip "ball"
appear and form part of the rectangle shape every time. i want to know if it's possible to random end_x a little bit, so make every 5 ball tween end at different point on the rectangle shape.
and when the animation end, is it possible to make it start all over again after a few sec? do i need a timer?
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var intervalId:Number;
var count:Number = 0;
var maxCount:Number = 10;
var duration:Number = 500;
i = 0;
jNum = 0;
mc = this;
formRectI = setInterval(formRectF, duration);
function formRectF() {
for (j=0+jNum; j<5+jNum; j++) {
var ball = mc.attachMovie("ball", "ball", i+10*j);
var ball_x = Math.random()*Stage.width;
var ball_y = Math.random()*Stage.height;
var end_x = 40+i*30;
var end_y = 40+j*30;
var timing = Math.random()*5;
var ball_tween1:Object = new Tween(ball, "_x", Strong.easeOut, ball_x, end_x, timing, true);
var ball_tween2:Object = new Tween(ball, "_y", Strong.easeOut, ball_y, end_y, timing, true);
var ball_tween3:Object = new Tween(ball, "_width", Strong.easeOut, ball_x, 10, timing, true);
var ball_tween4:Object = new Tween(ball, "_height", Strong.easeOut, ball_x, 10, timing, true);
}
jNum += 5;
if (jNum>5) {
jNum = 0;
i++;
}
if (i>=10) {
clearInterval(formRectI);
}
updateAfterEvent();
}
is there any flash guru can help me out?
|