ActionScript 3.0 :: Why Is Penguin Fat After Changing Direction Using "scaleX"
Mar 16, 2010
My Code:
Code:
var facing:int = 1;
if (xspeed<0) {
walker();
[code]....
I have my "hero" as a MovieClip that I placed on the stage, and resized. But when he changes direction his width reverts back to the original thats within the MovieClip.
View 2 Replies
Similar Posts:
Nov 23, 2010
I have created a custom component - MyImage - that has two children including a Bitmap as well as a Sprite.My display object hierarchy is as follows -
mx:Canvas
view:MyImage
mx:Bitmap
[code].....
View 1 Replies
Sep 21, 2009
I have small popup box which expands from size zero to some size when clicked on the expand button.
The location of this expand button is dynamic.Hence I want to change the the direction in which this expansion happens depending on the position of the expand button.
For example if the expand button is at the bottom right corner of the stage i want the popup box to expand upwards and leftwards.
If the expand button is at the top left then i want the popup box to expand downwards and rightwards.
I have only one movieclip for the popup box with the registration point at the top left corner.
I tried to achieve this by dynamically changing the registration point of the popup box movieclip using the DynamicMovie class. But no luck.
If I manually change the registration point it is working.
View 2 Replies
Jan 3, 2011
Would some wonderful person be willing to take a look at this code and tell me what I'm doing wrong?
I'm trying to use ENTER_FRAME method to get a moving movieclip to change direction when it hits certain x and y coordinates. I want the movieclip to move horizontally, then down, then horizontally again. With this code my movieclip starts off moving down at a diagonal and I can't for the life of me figure out why. (probably something simple I'm overlooking?) I'm a beginner at actionscript.
[Code]...
View 4 Replies
Jun 27, 2006
I have been following through the "gallery" tutorials here on Kirupa, and finally got to the third version (the one with the auto-scrolling thumbnails along the bottom, which scroll left / right based on the mouse pointer position, and the keyboard Left / Right scrolling).
I need my thumbnails to scroll UP and DOWN instead of LEFT and RIGHT, and have been trying to modify the ActionScript that came with the downloadable .fla file for the tutorial, but without complete success yet. (The functionality of the whole thing is still intact except for the scrolling thumbnails.)
Here is the portion of the AS that addresses the thumbnail scroller, and I have highlighted in red the variables that I believe need to be swapped around for it to scroll vertically instead of horizontally. I have made the obvious changes such as :-
_width changed to _height
hit_left changed to hit_up
hit_right changed to hit_down
_x changed to _y
[Code].....
Again, this is the ORIGINAL ActionScript, not my modified version. Only the items highlighted in red have been changed in my modified version. Basically when I test the movie now, I get the last two thumbnails of the gallery transposed one over the other, at the point of the movie clip instance, and no scrolling at all. When I use the UP and DOWN keys, I do get to "manually" scroll through the big images, but no change in the thumbnail area.
What have I screwed up or overlooked? I have scanned and scanned and scanned the above section of the AS, and I can't see any other variables that ought to be meddled with.
View 4 Replies
May 13, 2008
I'm currently having problems finding anything thats helps me change the direction an image is facing depending on mouse moment. I've found stuff on rotation, but I want my image to flip so its facing the other way.
View 4 Replies
Jan 4, 2010
I am creating a ping pong game. And I want to create the ability to control the direction of the ball based on the impact on the paddle. If the ball is coming down at vy = 4; vx = 4;
and the paddle is moving to the left at vx = -5; I want the ball to slightly change its course depending on how fast the paddle is moving. It would probably reduce the balls vx speed on collision, therefore making the ball move more straight (close to the Y axis) when it is moving back up.
I figure the solution for probably doing this would be to measure how fast the paddle is going. My problem is the paddle is controlled by the mouse and has no certain speed. I am trying to figure out how I can measure the speed of my mouse traveling on the x axis.
I am probably going to create a timer that fires every few seconds to determine where the mouse was and where it is at. figure the difference and that will be the speed
View 3 Replies
Aug 20, 2011
I am trying to make a bowling alley type of game. I want the ball to change angle when it reaches the gutter, but the problem I am facing is, how can I check when the ball has reached the gutter as the bounding box for a line/box in perspective is bigger and I want to check any point on the line when the ball is passing/crossing that point and moving so that I can change its angle and direction. And also does anybody have a collision method algorithm or physics to create the falling of PINS when the ball hits the PINS.
View 1 Replies
Feb 24, 2009
i have a scroller developed in as2. it basically scrolls continuously in a direction until the direction of the mouse is changed. the images of course loop in the continuous scroll. now the problem is that for 10-15 photos its ok. but when i feed it with 180 photos, it seems to show only 11. why would this be? any restriction on flash ??
View 1 Replies
Mar 17, 2011
have a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..
ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
[Code]....
how to make that first ball did not change its direction and continued to fly in the direction of the shot?
View 5 Replies
Jan 6, 2010
I'm probably missing something very basic but when I scaleX and scaleY 1 to 1.01, it sizes much larger than 1% and won't scale bigger by any smaller increments.
View 5 Replies
Mar 16, 2009
I am trying to create a Japanese map where on mouse over prefectures (states) would zoom in by some 1.2.If I make every prefecture_mc as a separate layer, then they scale on under another which, my friends is not good looking behaviour . when I create all 47 prefectures within one layer, then prefecture_mc:scaleY=1.2; is ignored. It was simple in AS2 besides it was scaling from the center
View 3 Replies
Mar 25, 2009
I've tried:
myratarray[count].scaleX=1|-1
is there an equation that only equals 1 or -1 that i need to know? I just need the array objects to move right or left at random...
View 5 Replies
Nov 3, 2010
Im trying to get a shape i have created to 'grow' and 'shrink as it enters different frames. Ive imported tweenClasses and i think i have everything done properly, only the scaleX and scaleY properties seem to change the position of the shape as well as its size, so instead of it just growing, it moves from the side of the stage toward the centre while growing. Out of curiosty, i decided to try altering just the 'x' and 'y' properties but they dont seem to do anything. heres the code i have:
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var infoBox:Shape = new Shape();
[Code]....
View 4 Replies
Mar 4, 2010
I want to scale the Text in a TextField to 80% width. Problem seems to be that TextFields don't respond to ScaleX. and ScaleY uniformly scales the whole TextField. Does anyone know how I can accomplish scaling the text to 80% width? And I then need to use that TextField as a Mask for a gradient (I know how to do that), so the route of using a TextBlock doesn't work.
View 4 Replies
Jul 26, 2009
I am developing a fishing game and I have inside my fla file a movieclip of a pirate ship, one of the bonuses of the game. In certain parts of the game I have to flip the ship horizontally because it depends on the player that he belongs. He can be on the left side or right side of the screen. I have read that to flip a movieclip horizontally the command is:
Code:
mc.scaleX *= -1;
In fact, this command worked for me with a static movieclip that I drew.But with the pirate ship, this line of command makes it disappear. When I remove the line, the ship is in the right place and behaves as it has to behave but is turning to the opposite side.Does it have to do with the fact that the movieclip contains animations?Another solution that I've tried is to flip everything but because there are a lot of keyframes and layers, it is impossible to simply click on modify->flip horizontal. The ship moves with tweens inside the movieclip, so I would have to rebuild all the animations.
View 2 Replies
Aug 2, 2009
What do scaleX, scaleY, rotationX, and rotationY do?I'd like to test it out myself but I'm completely new to Flash CS4 and I don't know how to control these values outside of ActionScript
View 3 Replies
Jan 26, 2010
I'm using a Bitmap cache that stores down a few Bitmaps. I called scaleX/scaleY on some of them, but the next time I retrieve from the cache, the Bitmap is screwed up. How does scaleX/scaleY work with Bitmap?
View 1 Replies
Dec 7, 2009
I am trying to scaleX and scaleY tween a movieclip. the problem im having is instead of growing frrom the centre of my movieclip, it seems to be scaling from the top left hand corner.
[Code]...
View 2 Replies
Nov 2, 2011
When I set the scaleX, it smooths. But this is not as efficient as redrawing the image (at least that's what I've been led to believe). But, scaling the image manually doesn't seem to smooth. Can someone tell me why. I'm using Flex and I add the image directly to a Group, so I have to wrap it in a UIComponent. Oh, and "this" refers to the Spark View component.[code]
View 1 Replies
Jul 22, 2009
i have a tween that moves a progress bar along the x using scaleX but when the user presses a button i want the progress bar to scaleX -= 0.2 but when i do this it scales to taht size but immediatly jumps back to where it was in the tweener tween.
View 1 Replies
Apr 2, 2012
Flash MovieClip scaleX not Scaling?
View 1 Replies
Aug 15, 2009
I'm getting the following error when I try to scale a movie clip .... PHP Code: Cannot create property scaleX on Number.
View 2 Replies
Apr 12, 2011
how a ScaleX/ScaleY event propagates down to the children of display object? I want to step in at some point and "re-scale" one of the children of a display object that has just been scaled with it's parent. I can't find any event that is fired, and ScaleX and width setters don't seem to be getting called on the child objects. I'm working on an ActionScript Project (not Flex) in FlashBuilder.
View 2 Replies
Sep 28, 2009
let me know what i am doing wrong here. this DOES NOT WORK.
ActionScript Code:
//add image
imageLoader = new Loader();
[code]......
View 2 Replies
Dec 9, 2010
Is there a way to use the scaleX and scaleY property in conjunction with the Tween class to scale from the center?ActionScript Code:[code]above unfortunately only scales from top left. This is not a class I can go in and move all the content by hand (so that the registration point is in middle) as it's all dynamic. I've looked al over but none seem to make use of the Tween class.
View 8 Replies
Feb 27, 2009
i want to know what is difference between width and scaleX or height and ScaleY ..? i search that in internet but i cudnt found good explanation
View 2 Replies
Mar 1, 2010
I'm using a tween on an imported file on MOUSE_OVER and MOUSE_OUT that will scale it X/Y up by 1.2. The problem is that the scaling starts in the upper left hand corner and moves out from that point. I want the scaling to start from the center.
Code:
new Tween(clipT,"scaleX",Elastic.easeIn,this.scaleX,1.2,.5,true);
new Tween(clipT,"scaleY",Elastic.easeIn,this.scaleY,1.2,.5,true);
View 13 Replies
Nov 13, 2010
I'm trying to change the size of a 20 pixel by 20 pixel square. I have instances of this same class all throughout my code, and I can change them with scaleX and scaleY, no problem. But these particular instances do not change visually. Using a debugger, I can go in and see that the code is running, their scaleX and width properties are changing to what I'm setting them to. But visually, on the screen, they don't change by one pixel.
View 11 Replies
Mar 25, 2010
My site is set up with next and prev buttons on the right and left sides respectively, and as you roll over either of the hit areas around the buttons a Sprite fades in which contains a TextField that describes the next page. Said Sprite calls the StartDrag() method, so it follows the mouse within the bounds, which is all fine and dandy on the left side of the page. Adobe, however, seems to have forgotten to put a way to dynamically alter the registration point of a Sprite, MC, whatever else, so when you roll over the right side of the page, the sprite is displayed from the top left and is mostly off the stage.
Trying to hack this problem I have tried numerous things ( classes written by others, other hacks) and the best that I have found is to use the scaleX method on the Sprite, changing the scale to -1. This, of course, makes the Sprite seem like it's reflected from its normal point, which means all its children show up backwards.
Is there anyway I can use this hack without it altering the text?
OR
Does anyone know a different way to go about displaying a Sprite from another corner? Any way to make a Sprite fade in and follow the mouse on the LEFT HAND side of the mouse pointer?
Here is a snippet to give an idea of what's happening:
naxtPage.labelBG.scaleX = -1;
nextPage.labelBG.startDrag( true, nextHitRect );
nextPage.labelBG.x = nextPage.labelBG.parent.mouseX;
nextPage.labelBG.y = nextPage.labelBG.parent.mouseY;
View 1 Replies