Smoother Tween Alternative To ENTER_FRAME Function?
Jul 5, 2009
I've got a tween which is called using an ENTER_FRAME event listener, as I need the movieclip to constantly tween until it's selected. However, the tween isn't very smooth, it's very jumpy and I'm guessing this has got something to do with the ENTER_FRAME event being constantly called. Is there a better way of creating a smoother tween?
Here's my code...
ActionScript Code:this.addEventListener(Event.ENTER_FRAME, ballFloat);private function ballFloat(event:Event):void { var myTweenX:Tween = new Tween(this, "x", Regular.easeOut, this.x, randomXBoundary, 10, true); TweenX = myTweenX; }// end of ballFloat function
View 4 Replies
Similar Posts:
Mar 5, 2011
I have made this animation, please click here to see it.
Username is hitenkajal.co.uk
password is sairam11
However am not happy with it because its not very smooth. I will like my animation like this [URL].
View 5 Replies
Mar 3, 2011
I am using the ENTER_FRAME function with Math.random to animate / simulate a random number range, as you might see in a digital voltmeter for instance.
the range goes from 12.0 to 12.9 and works good, but my problem is that i need to slow down the rate at which the numbers change.... A LOT.
Is there anyway to do this without slowing down the whole timeline???
Currently my AS is confined to the digital volt movieclip.
This is what i have:
addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler_1); function fl_EnterFrameHandler_1(event:Event):void{ var newVal:Number = 12 + (int(Math.random()*10)/10); volt.text = newVal.toString();}
View 2 Replies
Mar 28, 2012
I am designing a game in which there are three doors on stage. The doors are each instances of the same symbol. The instances are named "door1","door2" and "door3". The symbol contains three frames-"color1","color2" and "color3"- each frame is a the same door in a different color.
I want the game to randomly select a color for each door at the start of the game. I have been trying to use variations of the following code:
var min = 1;
var max = 3;
function doorColor (event:ENTER_FRAME, getNewDoor)
[Code].....
Why is the ENTER_FRAME tagnot working correctly?
View 5 Replies
Feb 15, 2009
For 2 weeks now I've been trying to debug what's wrong with my application, in failing to upload a file. I traced using firebug, and flash doesnt even TRY to access the aspx script which uploads.So Im trying to look now for an alternative, preferrably using javascript. Like taking all that upload behavior to be javascript's responsibility rather than flash's responsibility.
View 6 Replies
Feb 18, 2009
What I want to happen is, user clicks button, button slides across screen, when the slide is finished frame 2 is displayed. I am getting an Output of:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at howTo_fla::MainTimeline/howTo_fla::frame1()
and my code looks like:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
[Code]....
View 3 Replies
Jan 20, 2010
I'm creating a image gallery and I have this code when I click on image
html4strict Code:
imageBox[curCell._name]._visible = false;
imageBox[mc._name].fadeIn();
What I want to setup is imageBox[curCell._name] to move out to left while fading out.
And imageBox[mc._name] moving right of the screen to center while fading in...
get a tween function to left and a tween function to center from right?
View 1 Replies
Aug 30, 2009
I have three dynamically created MCs on stage and when I press on first one I want to initialize ENTER_FRAME function , but Im getting this error:
[Code]...
View 4 Replies
Aug 8, 2007
I'm trying to find a function that will repeat my Rotational tween function. I found the yoyo() function to be what i want to do but i don't want the tween to change the rotation to CCW while originally moving CW. Basically i want the animation to move CW at a steady rate continuously.
I'm using the following code at the moment, i'm not too sure if this is the most suitable code for this situation, maybe im off track.
From my thoughts, i assumed that i would need to put the stars function in a onEnterFrame to repeat the animation and change yoyo() to continueTo() function. or maybe some sort of if statement in the stars function?
ActionScript Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var stars:Tween = new Tween(ring, "_rotation", Regular.easeInOut, 0, 360, 4, true);
[Code]....
View 5 Replies
Dec 1, 2009
I found a script to make the animation follow the mouse movement and it needed to stay in fixed boundaries. I have 3 different mc 1 behind the other and moving at a different pace to give a illusion of perspective. But here are my issues;1-It works but when I open a new window in the browser the mc(s) are disappearing. 2-And I would really need to ease or smooth the animation a little. I would like the mc(s) to continue to move and stop slowly after I already stopped moving the mouse. how to script both or even 1 of these ? Here's the code I am using now;
function loopX(e:Event):void
{
var xDist:Number = mouseX - 24000
[code].....
View 0 Replies
Mar 5, 2007
Im changing the quality of a loaded clip with this._quality = "low" to make the animation run smoother, but it affects the parent clip as well, which I don't want it to do.
View 1 Replies
Apr 29, 2004
I normally spend hours battling with the simpliest AS and eventually work it out.I've trying to run the following AS applied to a button:
on (rollOver) {
i = getProperty(this.button01, _alpha);
while (i<100) {
if (i>100) {
[code]....
The action seems to work, however the increment is instant and I want to achieve a smoother transition.
View 10 Replies
Apr 11, 2007
I was looking through the tutorials on kirupa and i stumbled across the dynamic animating mc's and i was intrigued. So i made a canvas graphic real quick and imported it into flash and tested it out. at first it didn't look so good not like paint on canvas, then i changed the blend to overlay and it looked much better.I would like it to have a smoother transition so you don't notice the circles and no jumping.
View 2 Replies
Jul 5, 2010
I wanted to make a flash game,it's about some fish swiming in a tank.All the fishes swim randomly,i don't need any rotation,just left and right direction will be fine with me.But the result is their actions are really odd. how to make them swim just like real fishes?And there's also another problem.When the number of fishes increased to 50 or more,the framerate will drop rapidly.
Now I use Tweenlite to control the swiming action ,and it works very well.But the framerate still drops if i add more than 40 or 50 fishes to the tank.I think there must be a better way to do this.
Here's my code
public function onEnterFrame(event:Event):void{
var time:Number = Math.sqrt(Math.pow(xOffset,2)+Math.pow(yOffset,2))/speed;
TweenLite.to(this,time,{x:x+xOffset ,y:y+yOffset*0.5 ,ease:Quad.easeOut,onComplete:moveComplete});
}*/
xOffset and yOffset in the code are random numbers
View 1 Replies
Sep 18, 2011
I have a problem where the images look a little pixelated because they have been scaled down alot, just need a way to make everything appear smoother.
I need the game I'm making to look high quality and also work at different resolutions so when I made all the graphics I made them massive and same for the stage size in flash.
The stage size is 2000*1500 and it's being scaled down to 800*600 which is an exact ratio, I didn't expect to see pixelization when scaling the images DOWN, that's why I made them so large.
If there's no options for smoothing things out, then does anyone know the best option for swapping images at run-time? This way I can have pre-made images for all the most popular resolutions.
View 1 Replies
Sep 19, 2007
What's generally going to run smoother, result in lower file size, and/or drag less:
if (condition){move a clip from here to there and if it goes too far, bring it back;}
else (!condition){do nothing, let it sit;}
move a clip here or there, regardless of any condition, so it's always moving, and bring it back if it goes too far;
View 5 Replies
Aug 15, 2008
I have this RPG-like screen where you have a character walking through.. the forest or something.. and the thing is.. it's lagging.. LOTS..On that scene.. there are quite a lot of Tree graphics and grass graphics.. I've tested this and apparently graphics run a lot smoother than movieclips with bitmap caching on..Also.. My character has lots of different hair styles all put into one movieclip.. and i thought that by removing them all.. and just have a attachMovie() script to pull in the appropriate hairstyle clips.. it would go faster..but apparently it doesn't seem to of made much difference..what other ways can i reduce the lag on flash?
View 1 Replies
Mar 2, 2010
If I load a swf in FlashPlayer standalone, it will play nice and smooth. If I load the HTML it's embedded in (with SWFObject) in a browser it stutters like hell. If I use my browser to open the swf on its own, that runs nearly as smooth as in the standalone player.
That the standalone player runs smoother is understandable, since it then doesn't need to go through the browser layer. A slight performance decrease when adding the HTML DOM layer is also understandable, but in my case the difference is huge!
If I were to guess:
Standalone: 100% (benchmark)
SWF in browser: 90%
SWF in HTML in browser: 30%
View 4 Replies
Oct 29, 2009
Lets say we have a movieclip "Enemy" in the Flash library and a class "Enemy.as" is associated with it which listens to ENTER_FRAME event as follows,
public function Enemy():void
{
//constructor of this "Enemy.as" class
[code]....
View 1 Replies
May 1, 2011
I'm trying to get smoother steps in checking the ProgressEvent when loading the image to the Loader.At this moment my eventrogressEvent checks the progress aprox twice within a second. Is there any way to make it check constantly (or more often), so the progres bar "grows" smoothly instead of "jumping"?
View 9 Replies
Dec 11, 2009
I'm using the tweener class but I'm not sure how to accomplish what this. What I'm after is to pan the object "img" to one side, than pan back, and repeat.[code]...
But what would be the best way to run the check on the first tween action, fire the second when the first it done, and repeat the whole thing when the second is done. Should this be a while loop? Or some kind of event listener?
View 1 Replies
Oct 23, 2009
I have a var that is always changing in my program... and i wana use that in my tween... but it seens to not be working .... i show what i mean ^^
var botao:String;
new Tween('botao', "y", Strong.easeIn, servicos.y, servicos.y - 200, tween_duration, true);
u know a way to use the var in the tween?
View 4 Replies
Jul 8, 2009
I have a movie clip which is brought on to the stage by a tween function called introTween. After the introTween has finished, it has an eventhandler inside it which calls on 2 new tween functions to start. These are tweenX function which contains the myTweenX tween and tweenY function which contains the myTweenY tween. these functions loop round to keep the movie clip floating along the bottom of the stage. The movie clip can be dragged by the user. The problem I have is that when the user drags the movie clip during the introTween the dragIt function is called (see below) and when called its looking to stop the myTweenX and myTweenY tweens. However, because the introTween function hasn't finished, and thus hasn't called the tweenX and tweenY functions...then the dragIt function can't find myTweenX and myTweenY to stop(). how I would go about solving this problem? Is there some sort of IF condition I can put in the dragIt function which looks at whether the tweenX and tweenY functions have started or even the myTweenX and myTweenY tweens have started?
[Code]....
View 1 Replies
Oct 8, 2010
i've defined a Tween object within a function, and i want to control that tween from another function.
This is the basic way i have the code set up currently:
// Define the function with my tween:
function updateSlide()
{
[Code].....
Now i'm sure it's not working because it's not within the same function, but what would you do to make this work? Some sort of global variable or global function? I'm not used to working in AS2, or with programming in general
View 2 Replies
Nov 1, 2009
import fl.transitions.Tween;
import fl.transitions.easing.*;
var homemanTween:Tween = new Tween(homeman_mc, "x", Elastic.easeOut, 1000, 50, 3, true);//frist tween
var adobeTween:Tween = new Tween(adobe_mc, "alpha", Regular.easeOut, 0, 1, 3, true);//second tween
how can I animate the 2nd tween after 3 seconds when 1st tween stops.
View 9 Replies
Apr 2, 2009
Code:
Tweener.addTween( container, { y: 1200, time: 0.6, transition:"easeInExpo" } );
addEventListener(TweenEvent.MOTION_FINISH, filltext);
i want to detect the end of a tween then run the filtext function, but this wont work.
View 3 Replies
Mar 17, 2010
I have been trying to assign tween function in an array through a loop in as3.I have 20 mc on stage, the instance names are obj1, obj2 and so on.I want to assign a tween function to each of them, the function looks like this :
Actionscript Code:
function startTween(e:TweenEvent = null):void {xTween = new Tween(obj1, "x", None.easeNone, obj1.x, Math.random()*20, 0.2, true);
[code].....
View 3 Replies
Nov 27, 2009
I have a .fla with 5 pics on my timeline and using tween function to roll them from bottom to top, what I need to get those images random from o folder or something.
pics= ["images/pic1.jpg",
"images/pic2.jpg",
"images/pic3.jpg",
"images/pic4.jpg", "images/pic5.jpg"];
[Code] .....
View 15 Replies
Jun 25, 2010
I have a number of cases where I have a tween happening in ActionScript, but I would like it to happen after a delay from the event that triggers it. At the moment I'm creating this delay by having a tween that does nothing (eg. an "_x" tween for which the start and end points are the same) and then using tween1.onMotionFinished = function(){to create the one I really want. Is there a way to create this delay more neatly?
View 1 Replies
Aug 5, 2010
My problem is my redrawMenu() function is not being called when onMotionFinished() is called.
[Code]...
View 1 Replies