IDE :: Change Xy Position Of An Object Using Buttons?
May 9, 2009
I started using Flash again after a "brief" hiatus (the last time I used it, Flash was on it's MX version ).I am trying to create an animation in which I can move across the stage a simple object (a circle, a square or a star, for example) using buttons (left, right, up and down)This was fairly simple using AS 1, even when I was no expert. The thing is that those simple ways are no longer working with AS 3.I spent a few hours doing some research until I found this nice tutorial on this same site:
Code: http:[url]....
I followed the tutorial, and all was working nicely, but when I attempted to do the animation from scratch, it simply didn't work .I even used the same names for all the objects and instances, but still nothiing.
View 1 Replies
Similar Posts:
Jan 27, 2009
I am working on project as under:on first step ( screen) there are 2 text fieldsuser inserts text in a field and on the second text field same text appear as he typeshe clicks on a button to go to step 2On the second step he has the written text from previous screen and buttons to change font, colors and position of the text box.
View 3 Replies
Jan 27, 2009
on first step (screen) there are 2 text fields user inserts text in a field and on the second text field same text appear as he types. he clicks on a button to go to step 2 On the second step he has the written text from previous screen and buttons to change font, colors and position of the text box.
View 1 Replies
Feb 15, 2012
A display object container on the stage has some bitmap images of sizes 50x50 arranged in a order one by one. Now if i click on any of the thumbnail image (bitmap) the entire container should move and position itself so that, the bitmap image clicked is placed in the center of the stage.
View 1 Replies
May 13, 2010
I'm hoping someone can solve this headache. Basically, I want a movieclip to move to the position of each of my buttons from any position along my x axis. Therefore, the movieclip needs to 'flip' to face the way it is traveling.At the moment I have the movieclip moving to the mouse x axis when I ROLLOVER the button and stop following the mouse when I ROLLOUT but the code won't flip the movieclip so I must have something wrong...
btn.addEventListener(MouseEvent.ROLL_OVER,followCa t);
btn.addEventListener(MouseEvent.ROLL_OUT,stopCat);
btn02.addEventListener(MouseEvent.ROLL_OVER,follow Cat);
btn02.addEventListener(MouseEvent.ROLL_OUT,stopCat );
[code]....
View 0 Replies
Jan 2, 2010
If I have several items that move across the screen but the user can click any of them at any time, how do I record the current position of any of the items item in order to use that data to change the position of the item after the user clicks?
This is what I am doing: I have 11 images that slide accross the screen. The user can click any of them at any time. When he clicks one I am scaling the image so it looks like it is comming forward (z axis) and then the rest of the images are scaled down so it looks like they are going back on z axis. So what I am trying to do is get the current position of the image when the user clicks the image so that I can use that to correctly estimate the scaling and moving of the image to make it look like it scales from the center and not from the top left corner. So if have a variable that gets the current position of the image being clicked I'm thinking I can change its position using something like: x = currentposition + -45;
View 9 Replies
Feb 16, 2011
I'm trying to trace the path of an object by using setPixel on the object's position every frame in a BitmapData/Bitmap pairing. These pixels aren't showing up normally and I suspect I have a fundamental misunderstanding of the BitmapData class. Here's what I'm doing:
public var contrailBase:BitmapData;
public var contrail:Bitmap;
private var contrailColor:uint;[code].....
Using this code, the red pixels don't show up. If I initialize contrailBase to 0xFF000000 instead then I get a black screen on which the red pixels DO draw, but I need the bitmap to be transparent except for the contrail. What am I doing wrong?
View 2 Replies
Jun 11, 2010
I'm stuck thinking about the best way to go about setting a line segment's position, I have a class Line(length, angle, previous) being called from a class Polygon. Right now I have:
public class Line extends Sprite {
public function Line(length:Number, angle:Number, previous:Line = null) {
if (previous != null) {
this.x = previous.end.x;
[Code].....
View 1 Replies
Mar 16, 2009
I've made an image slider in flash and need it to slide out at it's current position before changing scenes.
The code i'm using is -
onClipEvent(load) {
_root.newXpos = 0000
speed = 10
[code]...
I need the '_root.newXpos = 0000' to tell the movieclip to stay in the X position it is currently in (it will be different each time as the user can move the movieclip via buttons, so a simple Xpos = 0000 won't do)Alternatively, I've tried adding -
on (press) { _root.newYpos = 476.2;
if (_root.Ypos =476.2);
gotoAndPlay ("Pxcotos", 1);
}
on a button but the scene changes before the movieclip has a chance to slide out.
View 4 Replies
Oct 22, 2009
I have a movie with on stage three rows of three movieclips, so 9 in total. I would like to change their positions randomly (time interval function) to x- and y-coordinates in the way that they "shuffle" each time. So for example, mc01 changes position to the positions of mc08, while mc08 goes to another position etc. So 9 changes to fixed coordinates eacht interval.
View 5 Replies
Jan 13, 2010
I've made an image slider in flash and need it to slide out at it's current position before changing scenes. The code i'm using is -
[Code]...
on a button but the scene changes before the movieclip has a chance to slide out. Is there anyway of telling the actionscript to wait before jumping scenes between the code?
View 2 Replies
Apr 5, 2010
I have 4 movieclip in the stage. Its instance names are mc_1, mc_2, mc_3, mc_4.
To change the x position of this movieclip I can use the below AS 2.0 code. It is working fine.
for (i=1; i<=4; i++) {
eval("mc_"+i)._x += 10
}
I like to know how to write this statement in AS 3.0.
View 4 Replies
Jun 13, 2011
My question is fairly straight forward: Is there a way to move the position of the mouse?within confines of the stage)I tried changing the value of mouseX/mouseY but it shows the following errors:I:FlashFlash ClassesMazegameMaze.as, Line 98 1178: Attempted access of inaccessible property mouseX through a reference with static type game:Maze.I:FlashFlash ClassesMazegameMaze.as, Line 98 1059: Property is read-only.
View 6 Replies
Aug 6, 2011
i wan to change my mouse coordinate to x->0, y ->0, possible?
View 3 Replies
May 17, 2011
I would like to draw a grid in perspective and draw a circle in in te left bottom corner.But I am not able to get it right.[code]...
View 1 Replies
May 4, 2011
Is there any way to define a movieclip position which is already on the stage?
View 7 Replies
Mar 2, 2005
Im trying to make a Mc to move around the canvas according to the mouse position. The Mc follows the mouse on the _y coordinates.Now I want to make it change position on the _x coordinates according to the mouse.It is working fine on the _xmouse position, but Im not getting it to work in the _ymouse position. Id like the Mc change position when the mouse is over a determined are on the stage.This is the code Im using
Code:
onClipEvent (load) {
this._x = 750;
//set original x[code].....
View 1 Replies
Feb 4, 2011
I need to create a site that works similarly to:
[URL]
Their webmaster shared that their navigation system is basically implemented by AS3 but also using swfaddress in order to achieve window.location changing.
All sections are cached with their Y position. Simply saying, contents container just moves to its corresponding Y position when a button is clicked or scroll bar is dragged.
How do I write script on a navigation button in order to have it scroll to a specific Y position within a tall scrolling site?
View 1 Replies
Nov 6, 2011
I've been looking everywhere but not solved my problem:In frame "2" I've got a ScrollPane with a long external sfw text scrolling. At his side I have buttons that links to a certain position of the scroll so they have:
on(release) {
ScrollPanename.vPosition=200;
}
(where 200 is n°of pixel down from the top)My problem is that I'd also like to have those shortcuts buttons on frame "1" (main menu) so they can jump directly to the ScrollPane position in frame "2" by press.
View 3 Replies
Feb 4, 2009
I've got this script that makes this certain symbol to move anywhere when you press the keys.Now I want a button that when you press it, it will position the certain symbol I was speaking of, anywhere I want counting on the x and y axis.
View 1 Replies
Feb 26, 2010
I have a script where i need an objects X and Y Position to change when you enter a certain frame.
On layer 1 i have an input text field with the instance of "message_txt" that runs along all 5 frames in the timeline.
On layer 2 i have 5 frames each with its own actionscript on. The user navigates between frames with simple 'gotoAndStop(4)' etc... on each next or back button.[code]...
View 2 Replies
Jul 31, 2009
With scrollPane, is it possible to change the position of the horizontal scrollbar? I saw an old thread that suggested using the following for moving the vertical scrollbar:scroller.verticalScrollBar.x=-20;So I tried changing it to "scroller.horizontalScrollBar.y=-20;" but that had no effect.
View 1 Replies
Aug 18, 2010
I have developed an application using various FMS2 Communication Components. One of those is the Chat component. The application has various display modes (minimized, normal, maximized). These display modes require the Chat component instance to be resized and repositioned on the screen. I took the approach of having a separate frame represent each of the display modes.
The problem I am having is that the Chat component won't resize or relocate from the size/position on the first frame. The visual layout isn't respected, and calling this.moveTo(x,y) has no effect either. The only way I can get the component to have the desired behavior is to comment out the last line of the Chat component actionscript[code]...
View 2 Replies
Feb 18, 2011
I have several objects, moveclip, graphics and shapes in several layers keys and want to change position, for example, a moveclip is in the position X: 218 Y:45 and so in other key layers,To change it to X: 240 Y: 50, I go to keyframe for keyframe touch the object and go to properties and change one by one is annoying.Is there any way to do this more quickly at one time in all key frames?
View 1 Replies
Jun 2, 2011
I have an xml flash gallery at a .swf file and i want to load this .swf to main.swf. So, i use the code:
[Code]....
aligned to the center of main.swf. How can i move this created movieclip to wherever i want with some code? I tried this:
MyGalleryContainer.y = 200;
MyGalleryContainer.x = 50;
with no results.
View 1 Replies
Sep 4, 2011
I didn't find that my flash is larger than the browsering area on screen until I publish and preview it in my browser but I do want all the content to be displayed on the screen. All I need to do is to move everything up for about 150 px.(in other words, to shorten the stage by 150 from the top but I can only cut the stage from the bottom ) Is there a way I can change the position of the stage like what I can do to the artboard in AI?
View 4 Replies
May 14, 2010
I'm trying to change the position of the dropdown list relative to the combobox item.Setting the position using comboBox.dropdown.x = 1337; doesn't work...
View 1 Replies
Sep 13, 2010
Is there a way to change the position of the registration point inside a Movie Clip using Flash5 ?I've found stuff online for older Flash versions but not CS5.
View 2 Replies
Dec 20, 2011
I have a s:List in my flex application attached to an ArrayCollection ( elements ). I want to change position of one element, so in fact I'm changing it's item index, the question is, how to do this kind of action ?
Here is a better example :
item 1 i : 1
item 2 i : 2
item 3 i : 3
item 4 i : 4
[Code]...
View 2 Replies
Feb 9, 2010
how I can change the X and Y positions where the ContextMenu displays. I know you can do it with the display() method, but not sure how to implement it. My code, so far:
ActionScript Code:
var my_cm:ContextMenu = new ContextMenu();
my_cm.hideBuiltInItems();
[Code].....
View 2 Replies