|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello, I am pretty new to using action script, and I am hoping that someone here can give me a hand by explaining what I have to do to animate (tween) certain property changes. For example: I have a square MC called boxOne, at a certain frame i wish to increase its width and height, which I did like this:
PHP Code:
I get the size that I want, but it does so instantly (in quantum step), but I wish to make it grow progressively (like a tween). What would i need to add/change to this script to acheive this? Yes, I know I can get the same result by shape tweening in the timeline, but I am trying to learn how to manipulate things such as dimensions, alphas, colours, x/y co ordinates, etc...and do so by tweening. Much thanks in advance to all who reply. Mike |
|
#2
|
|||
|
|||
|
When you use onEnterFrame whatever is in that function is going to be called one time for every fps. If you want something toi gradually get larger use something like...
PHP Code:
you can just play around with that. |
|
#3
|
|||
|
|||
|
Edited
|
|
#4
|
|||
|
|||
|
Delete these last 2, it posted the same message 3 times for some reason.
|
|
#5
|
|||
|
|||
|
On the same vein of motion tweening with aciton script
Ok, as mentioned in my previous posts, horribly new to action scripting(picked up the book yesterday), I think i've done pretty well, by creating the following
My main layer contains the following actionscript functions: size=1; function buttonincrease(butpoint, butpoint2) { butpoint._width+=size; butpoint._x-=(size / 2); butpoint._height+=size; } function buttondecrease(butpoint, butpoint2) { butpoint._width-=size; butpoint._x+=(size/2); butpoint._height-=size; } I have two buttons on that layer that contain the following: on (rollOver) { _root.but1.swapDepths(_root.but2); _root.but1.onEnterFrame = function() { _root.buttonincrease(_root.but1); } } //on (rollOut) { // _root.but2.swapDepths(_root.but1); // x=0; // while (++x<20) // { // _root.buttondecrease(_root.but1, _root.but2); // } // } now everything works, except, that I want the button to expand gradualy, like a motion tween as asked in the earlier part of this thread. The answer that was given was specific to the onEnterFrame handler. As you can see I implemented the onEnterFrame function and it works, it increases regularly, but it dosen't stop it just keeps increasing, and increasing, and increasing, I've looked around in this stupid book that I have, which by the way makes no mention of the _x and the _y properties, all it says is that flash objects inherintly have co-oridinate handlers, but dosen't tell you what they are! how cheap! It took me 2 hours to find the _x and _y, I've searched for the onEnterFrame to try and better understand it's functionality, and why it won't stop, and have gotten no where. I am attaching my fla, to those that can help, i appreciate it, even if you don't know the answer, but can think of some key words that I can google myself, that would be appreciated also, I don't mind doing the leg work as long as someone puts me on the right track. Oh also, any suggestions as to reducing code size will help, i know that i can use a few recursive functions in there, but i'm not 100% sure how to implement them. Thank you for any help that you can offer. Last edited by lapidus : January 28th, 2004 at 01:27 PM. |
|
#6
|
|||
|
|||
|
Hi,
Code:
function buttonincrease(butpoint, butpoint2)
{
// I used 20 due to your later "while" statement..20=maxsize here
if(butpoint._width < 20)
{
butpoint._width+=size;
butpoint._x-=(size / 2);
butpoint._height+=size;
}
}
function buttondecrease(butpoint, butpoint2)
{
// You should change 0 to be whatever the minimum size should be
if(butpoint._width>0)
{
butpoint._width-=size;
butpoint._x+=(size/2);
butpoint._height-=size;
}
}
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > A Simply ActionScript Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|