Tween in a button
Is there a way to make a tween work inside a button? Say if
you create a button then add a few more keyframes besides the usual
UP, OVER, DOWN and HIT, and then create a motion tween starting in
the OVER keyframe in order to animate the button, is there a way to
make this work? I've been trying with no luck and wondered if it is
because I'm missing a simple step. Does this sound possible? Or am
I out in left field (again)?
THANKS!
I did this years ago, so I am not sure it's the best way. I
turned the image in my over frame into a movie clip. That way it
has it's own timeline and I could animate the mouseover anyway I
wanted.
Personally, I wouldn't use a button at all, just make a movie
clip. Then add actionscript to the movie clip to make it function
as a button. There are things like onClick, onMouseUp, etc. I am
not that great with actionscript, especially 3.0, or I would give
an example. Maybe someone more knowledgable than myself can give
you one.
Hopefully this will help you some.
Similar Messages
-
Play motion tween until other button gets clicked
I want to make an animation where a person dances: there are 4 buttons and when one button gets clicked, the person starts and loops a specific motion tween. I already have everything, until now only a picture is shown on click:
function clickSpecialMove(event:Event):void {
! trace("SpecialMove");
! gotoAndStop("SpecialMove");
BeHappy.addEventListener(MouseEvent.CLICK, clickBeHappy);
function clickBeHappy(event:Event):void {
trace("BeHappy");
gotoAndStop("BeHappy");
Twinkle.addEventListener(MouseEvent.CLICK, clickTwinkle);
function clickTwinkle(event:Event):void {
! trace("Twinkle");
! gotoAndStop("Twinkle");
HandsUp.addEventListener(MouseEvent.CLICK, clickHandsUp);
function clickHandsUp(event:Event):void {
! trace("HandsUp");
! gotoAndStop("HandsUp");
but I wan't a motion tween to play:
gotoAndPlay("motionTwinkle"); does not work, then all motion tweens just walkr through like in a film :...can anybody help me? that would be so nice thank you!How do you implement the animations? What makes the animation loop? For all of the code you show you only have gotoAndStop() commands. What do those have to do with the gotoAndPlay() you mention? Why do you have exclamation marks leading several lines - remove those if they are actually in your code?
-
Make Tween button inactive while _MC is tweening
Hi there, can anyone help a novice flash user!
I've set up 2 buttons to tween a movie clip to go diagonally
left or right. I need to prevent the user from clicking the buttons
(make them inactive) while the _MC is tweening but I still want the
button visable then as soon as the _MC has reached it's new tweened
position the buttons should be active.
many thanks for any help!Hi there, can anyone help a novice flash user!
I've set up 2 buttons to tween a movie clip to go diagonally
left or right. I need to prevent the user from clicking the buttons
(make them inactive) while the _MC is tweening but I still want the
button visable then as soon as the _MC has reached it's new tweened
position the buttons should be active.
many thanks for any help! -
EVERYTIME I MAKE A MOTION TWEEN, WITH A BUTTON, THE BUTTON NEVER WORKS.
ANY SUGGESTIONS??ok what??
and didnt you use to be-able to attach a file on here? -
Tween problems in ActionScript 3.0
Hello!
I'm stuck with my problem and I have no idea what is wrong. I'm making movement of movie clip via creating new Tween in Action Script 3, Flash CS4 and it happens, when I mouse over button in another movie clip. The problem is that movement sometimes work perfectly, but sometimes it gets stuck in middle of movement and continues only if I mouse over again. Here is the code of function of first frame in main scene:
import fl.transitions.Tween;
import fl.transitions.easing.*;
function btnOver(I:Number) {
var tw: Tween = new Tween(somemovieclip, "x", Strong.easeOut, somemovieclip.x, I, 1, true);
Here is how I'm calling that function from another movie clip when I mouse over a button:
function over(eventObject:MouseEvent) {
(root as MovieClip).btnOver(288);
btn.addEventListener(MouseEvent.MOUSE_OVER, over);
I have several motions like this - for each button different variable for x position (number "I"). I also have another movie clip playing at the same time, but it isn't connected with any of movie clips mentioned above.
Does anybody have an idea what is wrong?
P.S.: I'm on Mac with latest flash player and movie works better in Windows - it has less mistakes, but still they happen very rare. Probably the problem is somewhere inside player or something like that?
Thanks!It looks like the problem is that you only have one Tween instance to work with. If you start one tween and start another before the first has completed, the first one has to stop working because that one Tween instance has to jump over to the new tween that's just been called.
You probably want to set up an individual tween for each button. You might also want to look into using something like TweenLite/TweenMax instead of the built in Flash tweening. Have a look at: http://blog.greensock.com/tweenmax/ -
Hi,
In a part of a Flash document, I need to use tween alpha, but I want to change the duration of the tween with some buttons. Does anybody have any suggestion or example?
I think that it is possible if I use variable for the duration and create a new Number by each button, but I don't know how. The tween is as below:
var TweenPulseA:Tween = new Tween (right_mc, "alpha", None.easeOut, right_mc.alpha, 1, pd, true);
How should I define var pd?
Thanks in advance.import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.MouseEvent;
var TweenRing:Tween;
var TweenPA:Tween;
var TweenPB:Tween;
var pd:Number;
function pulse(): void{
TweenRing = new Tween(ring_mc, "alpha", None.easeOut, 0, 1, 0.5, true);
TweenRing.addEventListener(TweenEvent.MOTION_FINISH, pulseDone);
function pulseDone (event:Event): void{
TweenRing.removeEventListener(TweenEvent.MOTION_FINISH, pulseDone);
TweenPA = new Tween(right_mc, "alpha", None.easeOut, right_mc.alpha, 1, pd, true);
TweenPA.addEventListener(TweenEvent.MOTION_FINISH, FadeOut);
function FadeIn (event:Event): void{
TweenPB.removeEventListener(TweenEvent.MOTION_FINISH, FadeIn);
TweenPA = new Tween(right_mc, "alpha", None.easeOut, right_mc.alpha, 1, pd, true);
TweenPA.addEventListener(TweenEvent.MOTION_FINISH, FadeOut);
function FadeOut (event:Event): void{
TweenPA.removeEventListener(TweenEvent.MOTION_FINISH, FadeOut);
TweenPB = new Tween(right_mc, "alpha", None.easeOut, 1, 0, pd, true);
TweenPB.addEventListener(TweenEvent.MOTION_FINISH, FadeIn);
function pulseMe (MouseEvent:Event): void{
//try stopping tweens
//don't throw any errors if a tween is undefined
try{TweenRing.stop();}catch(e:Error){};
try{TweenPA.stop();}catch(e:Error){};
try{TweenPB.stop();}catch(e:Error){};
//reset alphas
ring_mc.alpha = 0;
right_mc.alpha = 0;
//set variable
pd = Math.random() * 2;
//start it up
pulse();
stage.addEventListener(MouseEvent.CLICK, pulseMe); -
Trying to associate buttons with a moving moving clip
what i have is a tween on a movie clip of a popcorn kernel on one layer and a tween on a button on another layer to follow the movie clip. i want to be able to roll over the kernel and make it "pop". i changed my over on the button to popped corn (this works) but i want it to stay popped for the rest of the tween. this is where i need help.
Give your movieclip symbol an instance name, "kernel" will be fine - instance names are assigned in the Properties panel where it says <Instance Name>), so select the movieclip on the stage and assign it the name. Do this for every keyframe for that movieclip.
Then create an actions layer and place an empty keyframe on it in the same frame as the first frame of the tween. Select that frame and enter the following code into the Actions panel...
kernel.onRollOver = function(){
kernel.gotoAndStop("popped");
where you will have a frame label of "popped" placed inside the kernel movieclip for the frame where the popped corn image is.
Here is a link to a working example I just made for you saved as a Flash 8 file.
http://www.nedwebs.com/Flash/AS2_poppedcorn.fla -
If you watch the short tutorial at
http://tv.adobe.com/#vi+f1590v1815,
you see that guy does a good job explaining how to do a motion
tween. His button "slides" into place from frame 1 to frame 24. But
there are no frames after frame 24 on either layer. So, what if now
he wants that button to be there, sitting still, from from 25 to
frame x, while animation happens on the other layer (or a third
layer)? Is he just supposed to go out to frame x and select it,
then click F5 to add frames, or F6 to add a keyframe?
Thanks,
ChristopheGotta love them wolves
At some point Flash introduced breaking apart text fields into individual letters before raw shapes(I can't remember the version off hand - maybe 8), which is handy when you want to motion tween the letters individually. So you could break them into individual letters, and then distribute to layers, and then motion tween them to create text effects. It might also be useful if you want to space/align or position them individually - a little bit faster than creating each letter separately. But yes, one extra Ctrl+B to get the raw vector!
Hope that helps,
Jen. -
Error #1009: Cannot access a property or method
Here's the context of the problem, in which I will try to include as much information as possible while keeping the explanation brief.
I am trying to make a portfolio website (architectural design + concept art). Flash / programing are not my focus and this is my first go at learning the software. Due to the nature of the content and my (lack) of ability in AS3, I want the the coding to be really simple and still let the site look good. The way the site is currently structured:
1) Basic menu buttons that navigate to sections of the site (brings up a new page).
2) Example, clicking on <Graphics> takes you to a new page and a sub-menu animates in (simple motion tween for the buttons to cascade down). This animation is a movie clip placed on the main timeline.
3) On the screen is also a slideshow for all the images within <Graphics>. Instead of multiple small slideshows, I combined them all into one, so as to avoid complications with add / remove from stage. There are prev / next buttons that keep images within their sub section (ie 1->2->3->1). The sub-menu buttons are suppose to link to the start of each sub section, much like chapters on a DVD. (The slideshow is a movieclip sub-nested in the menu movieclip).
Main menu buttons work.
Sub-menu animation works.
Slideshow works.
Can't get the sub-menu buttons to access the slideshow chapters.
I have created and solved about half a dozen errors, and each time I fix something, it just causes another point to break. I've gone around in circles for days, and not sure which was is up anymore. So, while the slideshow works independently of the rest of the content, and I think I have the parent referencing correct, the problem I am currently facing is thus:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at 03graphics_fla::MainTimeline/frame1()
I've browsed some other threads, and I think I know what the problem is. Since the sub-menu is animated, the buttons do not appear on frame 1 of the nested timeline, while the actionscript is on frame 1 of the main timeline - thus the code doesn't exist yet when I click the button.
Is this indeed the problem? If so, how do I go about fixing it?
Additionally, does the structure makes sense on how my site is organized? Is there an easier / cleaner way to code it?
(This thing is completely ghetto-rigged, I just need it to function - it's like my own little Millenium Falcon...)
Cheers,
AndyTry following this posting, which is just a posting or two away from your own in the forum...
http://forums.adobe.com/thread/748542?tstart=0 -
How do I fade one frame into another?
In Flash pro 4 how do I fade out of one keyframe and fade into the next one with a slow transition? thanks.
Try this set alpha to 0. Move ahead 20 frames or how fast or slow you want it.Change the alpha to 100%.Then create motion tween in the button symbol and place the movie clip in the over state.
Then it should fade as the movie plays.You can implement it the way you want it.
Hope this helps
Good Luck! -
Urgent!!! Linking Issue
Hi everyone,
I've been searching around the forums trying to find an answer to my problem but I cannot.
I am creating a full website for a class (which was due at 12:00) and need some help with links that are failing.
Although they work in the preview mode, once i upload the pages onto the internet the links are no longer working.
The code I was tyring to use is,
on(release) {
getURL("http://www.rumeryrefinishing.com/gender/home.html","_self", "GET");
I read someplaces that the getURL code is outdated or something but I have other links on the page that are not written like this that are not working. Anyone know what my issue is?
Basically, what I need is an easy way it to get from this page: http://www.rumeryrefinishing.com/gender/intro.html to this page: http://www.rumeryrefinishing.com/gender/f_toys.html
Thanks for the help guys!The code is not likely to be the issue, but do get rid of the "GET". Do your buttons exist across various adjacent keyframes, such as frames where the buttons transition into place? If so, you may be losing functionality due to what I consider to be buggish behavior that Flash has always exhibited.
If you do not assign the code to all the keyframe instances, you can end up having latter buttons inheriting things from earlier adjacent ones (such as the lack of an instance name, and possibly code). For instance, if I do a timeline tween of a button and assign it an instance name in the ending keyframe, but not int the starting one, the one at the end loses the instance name even though it is assigned at that frame. -
ActionScript 3 code help?
I am a newbie to flash and only know some simple stuff. I would appreciate some help please?
I'm trying to create a simple tween animation with button, the animation work perfectly,
The problem is that I want my animation, to play also if there is no button action... like a loop function or a replay?
There's my AS3 code
import fl.transitions.Tween;
import fl.transitions.easing.*;
var tmelX : Number = 0;
var coletteX : Number = -958;
var lakayX : Number = -1916;
var offerX : Number = -2874;
var xTween:Tween;
xTween = new Tween(content_mc,"x",Elastic.easeInOut,content_mc.x,coletteX,2,true);
var buttons : Array = [btn1,btn2,btn3,btn4];
for (var i:int = 0; i< buttons.length ; i++){
buttons[i].addEventListener(MouseEvent.MOUSE_OVER,navigate);
function navigate(event:MouseEvent):void{
switch (event.target){
case (btn2) : setTween(coletteX);
break;
case (btn1) : setTween(tmelX);
break;
case (btn3) : setTween(lakayX);
break;
case (btn4) : setTween(offerX);
break;
function setTween(tweenX:Number):void
xTween.begin = content_mc.x;
xTween.finish = tweenX;
xTween.start();// time between auto rollovers is idleTime+timeBetweenRollOvers (=5 seconds in example)
var idleTime:int = 4000;
// time between each buttons rollover
var timeBetweenRollOvers:int = 1000;
var t1:Timer=new Timer(idleTime,0);
t1.addEventListener(TimerEvent.TIMER,navF);
t1.start();
var buttonIndex:int;
var t2:Timer=new Timer(timeBetweenRollOvers,4);
t2.addEventListener(TimerEvent.TIMER,timerF);
function navF(e:TimerEvent):void{
buttonIndex=0;
t2.start();
function timerF(e:TimerEvent):void{
buttons[buttonIndex].dispatchEvent(new MouseEvent(MouseEvent.MOUSE_OVER));
buttonIndex++;
this.addEventListener(MouseEvent.MOUSE_MOVE,mousemoveF);
function mousemoveF(e:MouseEvent):void{
t2.reset();
t1.reset();
t1.start();
import fl.transitions.Tween;
import fl.transitions.easing.*;
var tmelX : Number = 0;
var coletteX : Number = -958;
var lakayX : Number = -1916;
var offerX : Number = -2874;
var xTween:Tween;
xTween = new Tween(content_mc,"x",Elastic.easeInOut,content_mc.x,coletteX,2,true);
var buttons : Array = [btn1,btn2,btn3,btn4];
for (var i:int = 0; i< buttons.length ; i++){
buttons[i].addEventListener(MouseEvent.MOUSE_OVER,navigate);
function navigate(event:MouseEvent):void{
switch (event.target){
case (btn2) : setTween(coletteX);
break;
case (btn1) : setTween(tmelX);
break;
case (btn3) : setTween(lakayX);
break;
case (btn4) : setTween(offerX);
break;
function setTween(tweenX:Number):void
xTween.begin = content_mc.x;
xTween.finish = tweenX;
xTween.start(); -
CS5 Animation HELP!!
Im using Photoshop CS5 and im trying to create a animation where a bar goes through the inside of the text, but when i move the object in the second frame, the first frame does the same! Can anyone help me? This problem is getting really annoying!
You might try something like the following:
Click on the screenshots for larger views.
1. Select the rectangle tool and make shape layer
2. Clip the shape layer to the previous layer (Layer>Create Clipping Mask) and
move the shape using the move tool to about the left edge of the white line.
3. In the animation panel press the Duplicate Selected Frames button and then
move the shape using the move tool to about the right edge of the white line.
4. Press the Tweens animation frames button in the animation panel and set as below.
5. Press play and see how it looks. (click the gif below to play)
None of these settings are set in stone and of my animation has a lot of room for improvement
so feel free to experiment with different settings, but this should give you the basics.
MTSTUNER -
It seems every issue I solve creates a new one.
I've got two buttons...(eventually there will be 15 or so)
You click on a button on a map and a slide moves on screen as you
mouse over and then moves back out as you mouse out. If one of the
slides moves over a button, that button no longer functions even
though the slide is gone. More specifically; shen clicking on
'discovery_In_btn' the slide 'discovery_mc' travels over my second
button 'nature_In_bt' and then moves back out but renders the
'nature_In_bt' button useless. This button works fine if I click on
it first.
argh... I've been struggling with this project for several
days and my boss is looking for me to produce something. I'm so
close. What is going on here?I think that this 'may' be caused by the duplication of tween
names here (once again ;) but it's getting better. since the tweens
for both buttons are named out/intweenA, B and C that may cause
come 'confusion' in the program. another thing that's awesome about
the event handler model under 3 is that you can use properties of
the event object to reference the calling object (and much more) -
this will also save you tons of code writing. by constructing the
tweens in this way will also let 'flash' handle the naming, as well
as make this code usable for 'any' button you apply it to, more
like the following:
EDIT: whoops - just realized that the positions will be
different for each button, in order to solve, store the initial and
final positions as properties of the buttons - I've modified the
code to reflect this.
Maybe you are looking for
-
WHY DO YOU DISABLE THE ABILITY TO VOTE ON MANY COMMENTS ON NEW MENU?
I see that one is no longer able to vote for many ideas your subscribers have suggested for the new menu on TV. Of course, all of the places one can no longer vote are NOT IN FAVOR of the new Menu. Why has voting been blocked on these comments? Ple
-
Dear All, I have a small query- Are CRM and BW an integral part of ECC 6.0? I mean, if I install ECC 6.0, will CRM and BW also get installed OR Do I need to explicitly install CRM and BW after installing ECC 6.0? If CRM and BW are an integral part of
-
Spro settings required to do Reservation?
Hi Gurus, what are the settings required to do reservation? pls help..
-
Downloaded firefox into new Asus CPU. But now site formats are all weird
Downloaded Firefox into new Asus CPU. The format for my home page (hotmail.com), and just about all other sites, is disjointed....even Google. lines of text merge into each other, some sites look like an excel spreadsheet. and other formatting glitch
-
Which Model 13" MBP for Aperture?
I am a heavy user of Aperture, and keep several other apps open constantly. I currently have a 2010 13" MBP that I've upgraded to 8GB, and it's always running right up against the limit of RAM. I plan to get a 13" Retina MBP, and I need advice on wha