ActionScript 3.0 :: Custom TweenLite Function - Stage Pixel Precision
Oct 17, 2010
I am doing a custom function like TweenLite.to, but there is one problem. I cast that function on many objects. And they all move a little bit differently. It only happens when I don't do Math.Round(bonus_move). If I use numbers for example 0.58. It moves every stage child differently on about - 0.05.
Here's my function:
Code:
Select allpublic function moveTo(child, speed, px, py){
// configurable
var movement_accuracy = 20;
var delay_duration = 2/(movement_accuracy/10) ;
var movement:Timer = new Timer(speed*12.5*delay_duration, movement_accuracy);
movement.addEventListener(TimerEvent.TIMER, timerListener);
function timerListener (e:TimerEvent):void{
[Code] .....
View 1 Replies
Similar Posts:
Oct 11, 2011
I am trying to make a game, I have worked out all the movement, shooting, updating stats techniques, but I have a problem that is not so obvious to me. I need to go to new frame(stages' new frame) every time left mouse button is pressed.
How can I tell stage to do gotoAndStop(); function from a custom class?
View 9 Replies
Dec 5, 2008
I am trying to create a custom blend mode much like the blur blend in Windows Vista, where all the of the contents in the windows behind the one on top are blurred. (I hope you understand what I mean.) I would like to accomplish this using a pixel bender effect, naturally. Unfortunately I can't get any kind of blurring (or for that matter, any image distortion at all) to work when I use a pbj file as a blend mode. These kinds of effects work fine as a filter, and seem to work fine in the toolkit as well, but don't seem to work at all in flash as a blend mode. it seems that flash doesn't allow you to sample any points except the current x and y that it is working on when used as a blend.[code]
View 3 Replies
Feb 11, 2011
Does TweenLite or TweenMax support the onChange function?
I would like to re-code using TweenLite/TweenMax to get my textbox to numerically display the constantly changing x position of my tween.
I did have this code before:
I tried some variations with the following to no avail:
nextTween1.addEventListener(TweenEvent.MOTION_CHANGE, onChange);function onChange(evt:TweenEvent):void {mph_digital.mph_counter.text = int((dial_graphics_mph.x * .20528)*10)/10;}
also how do i define tweens as variables now with TweenLite / TweenMax?
View 2 Replies
May 30, 2010
For some reason my TweenLite function won't work. Doesn't give any errors, but it just doesn't do anything and thus the onComplete function won't work to continue the script.
[Code]....
View 3 Replies
Jun 1, 2011
Its pretty simple what im trying to achieve.I have a MC on Stage, which im trying to tween to different X coordinates.I've set up four TweenLite.to sequences, however for some weird reason only one is being triggered - what am I doing wrong?
TweenLite.to(slider.mc_slider,1,{x:_returnXPos(95), ease:menuEasing});
TweenLite.to(slider.mc_slider,1,{delay: 1, x:_returnXPos(35), ease:menuEasing});
TweenLite.to(slider.mc_slider,1,{delay: 2, x:_returnXPos(50), ease:menuEasing});
[code].....
View 3 Replies
Jun 11, 2009
I'm having this trouble with Tweenlite. I downloaded it and started to use it since it was quite easier to do the tint morph, and that part works great! However, one thing I've noticed is that for some reason, If i activate more then one thing that has a function at a time, it will freeze up most of the time.
For example. When you click on one of the links in the Nav Bar, it uses Tween Lite to scroll to the page you selected, with out trouble. So after I had done that, i wanted to make it so that Upon rollover, the Links in the Navbar would change color. Now they both still do what they are told yet 90% of the time one of them freezes, whether its the page that scrolls halfway and stops, or the color on the link halfway to its final destination color. Is there a known fix for this or is this the tradeoff?
View 14 Replies
Apr 1, 2008
I want to call a function from another function's parameter but I don't know how and don't know if it is possible.I've considered this as a solution but it didn't worked.
Code:
function myFunc(target_mc:MovieClip, nX:Number, nY:Number, cFunc:Function) {
target_mc._x += nX;
targen_mc._y += nY;
target_mc.onPress = cFunc;
[code]....
View 2 Replies
Mar 25, 2010
After I finish a tween, I would like to change my variables, then only my mouse movement would have start to run some functions, but it seems like the onComplete function fired immediately messing all the things out. Isnt't that onComplete function will only run after an action is done? Any other way to like after running the Tween.to line of code, only it will ran the 2nd line changing a variable?
stage.addEventListener(MouseEvent.MOUSE_MOVE, movevC);
public static function showSection(obj:DisplayObject):void {;
var sect2X=((obj.stage.stageWidth/2)+(obj.stage.stageWidth/4))+lg.width;
var sect2Y=((obj.stage.stageHeight/2)-(obj.stage.stageHeight/4))+lg.height;
switch (obj.name) {
[Code] .....
View 3 Replies
Apr 4, 2012
I am trying to combine TweenLite with some of my own functions. Now for testing I have this:
Code:
function playGeb(indG):Void {
if (indG < 8) {
clearInterval(restartG);
gebArr[indG].play();
[Code] .....
but after the arrow is in place the function hello() isn't been called.
I already tried adding, onCompleteScope:this
TweenLite.to(arrow_mc, 0.3 , {_x:118,_y:30,onComplete:hello , onCompleteScope:this});
View 1 Replies
May 31, 2010
I am getting a 1009 error using tweenlite. I have placed the COM folder of tweenlite in the same directory as the FLA. On the main stage I have imported the tweenlite class using:
Code:
import com.greensock.*;
import com.greensock.easing.*;
On the main stage I have a MC called mainholdermc. When I click a button called mentions but on the main stage it basically tells mainholdermc to play. This works well. I have another movieclip called vosdes. At the same time that mainholdermc plays I want to use tweenlite to make the aplha of vosdes lower. If I put this actionscript on the main page it works fine:
Code:
mentionsbut.addEventListener(MouseEvent.CLICK, mainholder);
function mainholder(event:MouseEvent):void {
mainholdermc.gotoAndPlay(2);
TweenLite.to(vosdes, 0.4, {alpha:0.1});
}
The problem is that I want to move the tweenlite command to within the the vosdes movieclip. So within the vosdes movieclip I have this written in the actionscript:
Code:
import com.greensock.*;
import com.greensock.easing.*
TweenLite.to(this.vosdes, 0.4, {alpha:0.1});
I found that by using
Code:
this.MC_NAME
it is the equivalent of the _root in AS2.
However this is not working. When I compile the FLA no errors occur until I click on the mentionsbut and I get the following error:
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.greensock::TweenLite/init()
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()
[Code] .....
View 2 Replies
Jan 22, 2010
I need to "tween" an object like in tweenlite, just x/y values, but have ran into a large issue.
[Code]....
it's kind of accurate at high 'refresh times', but low ones, or long tweens it's very inaccurate. Basically, it needs to move 300pixels/1000ms, I chose to move it every 10ms, the amount I move it is 3000/1000(ms/pixels)*ms=3pixels every 10ms, so we should get to 300pixels moved over in 1000ms. But it doesn't work- the time intervals aren't consistant, sometimes it moves it after 10ms, sometimes it doesn't catch it to move again for 30ms! Tweenlite is able to bypass it's loop being able to run every 10ms, but how?
View 2 Replies
Nov 21, 2010
add a 1 pixel border around the entire stage so it appears in swf?
View 3 Replies
Jun 8, 2011
Is there a way to retrieve the color of a generic pixel on the screen using the mouse pointer inside the Stage of Flash Player? With the getPixel method of the BitmapData class you can get the color of a pixel only if the mouse is over a bitmap image, but what if I need the color a generic pixel on the screen?
View 4 Replies
Oct 15, 2008
I want to getpixel value of a pixel in Stage. Stage is dynamically created and its have movieclips or images, thats are all dynamically created,
But Now I need to get a pixel color value of (150,150) in the stage,
View 5 Replies
Aug 26, 2010
I am trying to make a panorama presentation (running across 5 screens of 1360x768 pixels each) and therefore I would like to make a stage resolution in 6800x768.
Flash CS4 Pro says no: max resolution 2880x2880 pixels. Is it in any kind of way possible to make a work around so I will be able to get the requested resolution for my panorama animation/presentatrion.
View 1 Replies
Apr 13, 2006
I am trying to make a so called pixel effect in witch I want to make a shape only from pixels that are positioned in some random place on the stage. And all these pixels move to a certain point and create that shape. I've been looking into BitmapData Class but I don't now if that is the best way to do it.
View 2 Replies
Apr 28, 2009
The following will ensure that any large numbers will only be precise to the hundredths place (related to this answer):
public function round( sc:Number ):Number
{
sc = sc * 100;
sc = Math.floor( sc );
[Code]....
What is the optimal way to round my numbers to the precision of .05? Is there something clever to be done with bit-shifting to get this result? For example, I would like:
3.4566 = 3.45
3.04232 = 3.05
3.09 = 3.1
3.32 = 3.3
View 2 Replies
Mar 18, 2010
I was searching for a simple collision detection function for as3, I found Collision Detection Kit, but it is too complicated, I just want a damn function that I give 2 objects as paramenters and that's it.I would like to know where can I find a pixel-perfect collision detection function (The faster, the better)
View 2 Replies
Mar 30, 2010
I am looking for a fairly simple image comparison method in AS3. I have taken an image from a web cam (with no subject) passed it in to bitmap data, then a second image is taken (this time with a subject) to compare this data, from these two images I would like to create a mask from the pixels that match on both bitmaps. I have been scratching my head for a while, and I am not really making any progress. Could any one point me in the right direction for pixel comparison method, something like getPixel32()
View 2 Replies
Jan 25, 2010
How do i get random number to a certain precision.AS3 generates random numbers between 0 and 1 using Math.Random().
View 2 Replies
Jan 31, 2011
I want to implement a gameplay recording feature in a project, which would only record player input and seed of the RNG at the beginning of the level. Then I could take such record and play it on my computer in order to test it for validity.I'm only concerned with some numerical differences which might appear between different Flash Player version, Operating Systems or CPUs (or whatever else that might be affected). The project would be written for Flash Player 10.0.0+. What stuff I am concerned with:
[code]...
I won't be using stuff like hitTest, getObjectsUnderPoint, hitTestPoint, getBounds and so on, all collisions will be geometrical.So, are there any chances that using any of the pointed things above will yield different results on different systems? If so, what can I do to avoid them?
View 3 Replies
Feb 15, 2011
I have one that's almost done and the stage size is 700x800 px. But I'm starting to worry if that's going to look too small? To change it, will be a lot of work - there's animation, imported Jpegs etc. As far as I can tell, in order for it to look correct in larger dimensions I will need to basically create it again from the ground up. So, I'd really like to get an idea of what the optimal pixel dimensions would be for ecards to run on multiple platforms.
I really want to do this and I don't feel like I can move ahead until I get the viewing size correct. I don't even mind redoing the card. I just want my future cards to be the correct size. I don't want to have to come back and redo them all. By the way, the cards are being made in Flash. The site itself will be created in DreamWeaver.
View 8 Replies
Nov 23, 2009
I have a 100x100px image. I want to get 1 pixel vertical line from x- 1 to 100. How can I do that?
View 7 Replies
Jan 19, 2010
Millisecond timestamp precision in FMS logs? This is for statistics monitoring.
View 1 Replies
Apr 17, 2010
I've been developing my current project some more and when testing it I received this message:
"TypeError: Error #1006: apply is not a function.
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/com.greensock:TweenLite::updateAll()"
It happens after the same amount of time every time. what's causing it?
View 13 Replies
Nov 23, 2010
[Code]...
"0-9" restricts my textInput field to numeric values and a decimal point. Is there a way I can extend this so only two places follow the decimal?
View 1 Replies
May 19, 2011
private function getPercentage(max:Number, value:Number):int
{
return Number((value*100) / max);
[code].....
View 1 Replies
Apr 28, 2010
I've been going mad trying to find a code that will make my custom cursor invisible when the mouse isn't on the swf.
View 2 Replies
Feb 21, 2009
I'm intermediate in AS2, and I'm starting work on custom classes. I am making a class called VolcanicIsland and I want it to make a movieclip on the stage when it is called. I do NOT want to make a variable MC that gets put into the arguments when it is called, however. Here is the external AS file (trimmed to the problem area):
ActionScript Code:
class VolcanicIsland extends MovieClip {
//position
private var x:Number;
[Code].....
View 1 Replies