Showing posts with label adobe. Show all posts
Showing posts with label adobe. Show all posts

Tuesday, December 04, 2007

Creating the time rag using Tween.

People put cool intro type effect all the time but one of them that i was dying to do through actionscript was time rag. i mean if you look at http://www.2advanced.com for example you can see stuff at the bottom coming in at different timing.

well i finally found out how to do this with action script. i guess it can be done just by animating manually but usually for these kind of thing it's way faster and more acurate to do it via ActionScript.


var speed:Number = .5 * i+1;
var xTween:Tween = new Tween(pp, "x", Back.easeOut, -300, 30, speed, true);
xTween.start();

if you look carefully into it you see a variable i

well yes this is inside the for loop. and iterates for how ever many movie clips that's inside of an array. i was doing this for my new photo gallery i was building.

Here i'm giving a variable speed 0.5 * i + 1
0.5 * i expresses difference in time.
+ 1 is basically an offset value so that the element 0 or the first one will still show up. (0 * anything is 0 so speed or time it takes will be 0 - in Tween class term it means do nothing)

so putting all elements that you want time rags when showing up in an array and create for loop and tween all of them with a bit different speed.

well if you are going to do this for 100 elements it might not work...


I'm still searching for a way to do real time rag which just keeps pause before triggering animation..

maybe if you use eventListever for MOTION_FINISH and 2 tweens it will.

Monday, December 03, 2007

Tweening the filters classes with actionscript 3.0

I was trying to tween blur or glow filters via ActionScript 3.0 and I came across this issue that it doesn't tween. After some trial and error I have figured out ways of tweening filters using tween class.

This really led me to understand tween and filter classes. Basically the object assigned to filters property is an object by itself and it's not a property of the MovieCLip. so the MovieClip cannot be updated unless of course some how reapply the object.

well enough about objects and my rambling so I'll post a code here to make it work.
for example if you are trying to create roll over filter effect.



function rolledOver(e:MouseEvent):void
{
filterTween = new Tween(e.target.bfOver, "blurX", Back.easeInOut, 0, 100, 2, true);
filterTween.addEventListener(TweenEvent.MOTION_CHANGE, updateGraphics);
filterTween.start();
}
function rolledOut(e:MouseEvent):void
{
filterTween = new Tween(e.target.bfOver, "blurX", Back.easeInOut, 100, 0, 2, true);
filterTween.addEventListener(TweenEvent.MOTION_CHANGE, updateGraphics);
filterTween.start();
}


function updateGraphics(e:TweenEvent):void
{
this.filters = [bfOver];
}


This is out of my DynamicButton class so you'll have to tweak a little or create your own but at least I hope you see what I'm doing here. If it successfully compiles then you'll see blur tween over 2 seconds with some easing.

Motion Tween or tween sends out MOTION_CHANGE event when they update properties. you basically catch this event to update the desired MovieClip's appearance.

Actually it was easy.

Now.. please don't ask me about CPU etc... I don't know.
I wish you could control stages or times it calls the function or steps for tween. then you can make it a little easy for CPU or older computers.

anyways, try it out.

Saturday, December 01, 2007

Dynamic Text Embed Font ActionScript 3.0 tips

this is another ActionScript 3.0 or Flash CS 3 tips.

What really stopped me from creating contents today was the dynamic text.. it is an amazing thing but this thing drove me crazy.

i basically had one button that is associated with a class and on rollover, rollout, click, etc tween starts so that it will animate according to an MouseEvent.

Problem I had was i was trying to tween alpha and it didn't kick in. trace shows that it's changing alpha.. i checked my tween also by trying the same tween with other properties like x and it totally works...

i had another regular button that doesn't associate with this button class and that one also was working fine.

only the one i have created through class... didn't do alpha tweens.. (just that didn't show result on screen...)

I really tried bunch of things like loading them into another MovieClip and applying tween to that MovieClip etc...

Then i went to check the differences between the buttons that does alpha tweens and don't.. i noticed one slight difference..
The one that worked had static text for labels and the one that didn't work had dynamic text.

so i went to research "dynamic text alpha" well Bingo.

in order to apply alpha tween to an dynamic text you need to Embed and font.

well first didn't make sense at all but i looked into property inspector for the text and on the right hand side i saw "Embed.." button. and ah huh! i clicked on the button and set it up.

Command + Enter to test movie and it works!!! now i can tween dynamic texts.

if you choose both all upper case and all lower case letters, you should be able to change label dynamically. and now i have a button that plays fancy animation. not like and HTML/CSS simple roll over but a button that does something and that's totally customizable. great.

took me too long to figure out this simple things but i'm sure you won't need to.

Friday, August 31, 2007

Document Class - Flash ActionScript 3.0 feature

Now you can assign class to a document...

you just define a class, and inside the property window for the document, you should see a text field saying "Document Class"

type in ULR or name for your document class (anything..) and you are good to go.

you can actionscriptically load graphics, etc pretty easily. amazing feature