ActionScript 3.0 :: Tutorial - Moving Star Out Of The Stage Center
Oct 25, 2011
This tutorial si about moving star out of the stage center, this is the script:
import flash.display.MovieClip;
import flash.events.Event;
var container:MovieClip = new MovieClip();
addChild(container);
addEventListener(Event.ENTER_FRAME, addstarred);
[Code]...
View 2 Replies
Similar Posts:
Oct 27, 2011
I'm working on my first game engine with AS3 and I'm hitting my first real setback. The idea is that the player controls a centered "turret" on the screen and can't move. Enemies come from all 4 sides and move towards the player. I have all the enemies spawning, randomly, on the edges of the screen. However their movement is silly, because I've coded it like this:
Code:
if (x > 300)
{
[code]........
View 2 Replies
Jul 5, 2011
well in my fla i have a movieclip exported with class name Star and in my Star.as file i have this code:
package { public class Star {
public function Star() {
this.visible = false;
}
}
i tried putting movieclip on and off stage but didnt work all i want to do is control my class Star in my fla. Im very new to OOP and trying to get the gist of how to control objects like the way you could by instances like i used to :/
View 5 Replies
Apr 7, 2011
I'm trying to get a triangle to spin in place,
View 7 Replies
Dec 5, 2011
I have a TargetCirlce_mc which moves on "y" axis from top to bottom. And I have an arrow_mc which is on x:100 & y:200. How can I shoot an arrow exactly on the registration point of the TargetCircle_mc (automatically) while it is exactly opposite to the arrow_mc?
View 1 Replies
Feb 21, 2011
I am in the midst of finishing up a design application where you can upload images and colors. I use the greensock transform manager. I am taking anything a user does and recording it so I can recreate what they made on larger scale behind the scenes (to be exported for printing purposes)
The problem I am running into is with rotation and moving x and y values. The transform manager does everything relative to a center point, but when i recreate the image object the registration point is at the top left. I have found how to rotate around the center of the object using the transform matrix, but I can't seem to move the x and y correctly because these values change when you rotate. I want to just move the image to the left or right relative to the center. How could I go about doing this.
Here is how I rotate.
private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) {
var m:Matrix=ob.transform.matrix;
m.tx -= ptRotationPoint.x;
[Code]....
View 1 Replies
Oct 30, 2009
I made a pact that I'll use only AS3 from now on but.. The tweening class is confusing me. Take a look at this: [URL]. Finding code that will make the earth move down into center of canvas and simultaneously grow larger?
View 21 Replies
Jan 31, 2010
I am trying to have flash draw a line from the center of the stage out and increment around the stage. Not sure what math I would use to do this though. So far I have the line going out to a certain point but not sure how to change that point so that it circles around whatever the dimensions of my stage would be.
So far I have this:
var linetox=0;
var linetoy=0;
var _stage=this;[code]...
which obviously moves the destination ending of the line lower and lower, just trying to get it to draw around the screen (like a clock)
View 1 Replies
Oct 24, 2010
I have a moving vehicle on the stage, which should change directions according to where I click on the stage.I already made it work using this formula:var angle:Number = Math.atan2(dy,dx)*180/Math.PI+90;However, I need the car to tween to the correct angle, instead of just "jumping" to it. While this is easy enough to do, the car sometimes takes the longer turn (especially when I click in the bottom-left quarter of the stage), and it seems unnatural.
View 0 Replies
Apr 20, 2009
I'm having trouble centering the stage on screen, its locked to the top left of my window and nothing will make it move. I remember accidentally pressing something on the keyboard just before this happened, but don't know how to get my stage center again. The hand tool does nothing.
Oh and its only happened in this fla, other fla's are fine.
View 3 Replies
Jul 11, 2010
I need to center a MovieClip, and i know how to do this, but the problem is this MC has content in it of different sizes on each frame. So when it goes to say, frame 2, the MC is no longer in the center. This is what i use:
ActionScript Code:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);
[code]...
How can that be changed to center this MC when the size of it changes? I would guess the code would need to know when the MC's size has been changed and re-align...
View 0 Replies
Feb 9, 2009
I have a MC on stage that I dynamically add and remove elements to and from. Since its dimensions vary subject to those changes I's like to "pin-point" it to the center of my (800x600) stage. I thought it would be agood idea to get the dimensions of the MC (it's called container) and set its x and y accordingly, but somehow it won't work as I got the feeling the registration is somewhere else (and I don't get the logic behind where it is).
The code I am using at the moment is the following
Code:
var dimensions:Rectangle = container.getBounds(stage);
container.x = 400 - dimensions.width/2;
container.y = 300 - dimensions.height/2;
View 3 Replies
Apr 20, 2009
I'm having trouble centering the stage on screen, its locked to the top left of my window and nothing will make it move. I remember accidentally pressing something on the keyboard just before this happened, but don't know how to get my stage center again. The hand tool does nothing. Oh and its only happened in this fla, other fla's are fine. See attached image for screenshot
View 1 Replies
Jun 2, 2007
I have a big movieClip which the user can zoom by click on a 'zoom-in' button. Once zoomed the user can click on that movieclip and pan it. Now the center of that movieClip is displaced and no longer where it was before. However, if the user click on 'zoom-in' now again, the movieClip should zoom from the center of the stage and not from the movieClip's center.
To put it simply, I want a formula which will zoom a movieClip from the center of the stage and not from its registration point, no matter where the registration point is.
View 3 Replies
Oct 4, 2009
I've ceated 18 buttons 1-18 on two rows and using the alignment tool made then all gapped the same and in line etc.
I now want to center the two rows of buttons on the stage.
I've shift clicked to select all the buttons but no matter what option I pick in window alignment I can't get it to work.
View 1 Replies
Feb 8, 2010
This is the code I'm using which loads in external swf's in 2 loaders, replacing each other. I just to center the main clip(tl) in the main swf, and can't figure it out![code]...
View 13 Replies
Jul 2, 2011
I needed to make my document size larger. Is there an easy way to center all the content in the new size? Right now everything is flushed to the top left corner.
View 3 Replies
Sep 8, 2010
How can i center the Movieclip x and y postion onto the stage. [code]...
View 1 Replies
Feb 22, 2009
I have this movieclip which i would like to set an rotationY in 3d space. I want the rotationY angel to have a value so that the right side of my movieClip faces the center of the stage. Like an arrow in a dartboard. I thought this was easy to accomplish using simple trigonometry like this: (before the testMC is rotated in Y space, it has a widh of 1000) testMC.rotationY = -(Math.acos((stage.stageWidth/2)/(1000))*(180/Math.PI));
View 1 Replies
Apr 15, 2005
I am curious abut two things... 1. Instead of a Bar at the bottom I wanna use a MC that will rotate in the center of the stage... With one half acting as a paddle, and the other side being a game over or life over side...
2. Also with the MC in the middle i want to use the arrays to make a pattern or whatnot *grid* around the middle move clip, so there is only one way to die and that is from the ball MC hittin ghte backside of the middle mc?
View 1 Replies
Aug 31, 2010
Is there a way on a drag zoom image viewer to have the draggable mc scale from the center of the stage rather than from its registration point?
View 1 Replies
Mar 22, 2005
I sent an email to pom regarding a tutorial that he wrote, but the email was bounced and he hasn't replied to my PM. I have followed both of pom's tutorials that involve experiments with perspective in Flash, but I have encountered a problem while attempting to duplicate a movie clip symbol in the second tutorial ([URL]). I have a single instance of the "ball" movie clip symbol appearing at random positions. However, I cannot seem to successfully duplicate the symbol instance at random positions using the loop that pom provided:
[Code]....
View 10 Replies
Aug 11, 2010
I have built a catalog in flash that was orginally built in InDesign and exported but it has some small content that is hard to read for the elderly users viewing it and I would like to add a zoom feature or some type of magnifying glass.
View 1 Replies
Mar 23, 2009
I've managed to put a text field onto the stage using AS2 but now I'm trying to make it stay in the center of the stage. [code]...
View 1 Replies
May 15, 2009
I am working on creating a website that has 4 large images in the center of the stage and I was trying to load them using XML. I have a pre-loader to detect how much of the flash site was loaded then once it's loaded it continues onto the main content. My problem is that it goes to the main content before the images are actually loaded and I'm not sure how to make sure that the content is loaded before moving on from the preloader.
View 1 Replies
Jul 8, 2009
I try to align center a sprite container in the center of the stage.
What can be the method to do it?[code]...
View 5 Replies
Mar 9, 2010
I've used the following code to create a textField and style it with a little CSS my problem is the textFeild is as wide as the stage and I want to center the text so its in the middle of the stage but when i use the css attribute textAlign the text is almost all the way to the right instead of centered
PHP Code:
var msg19:TextField = new TextField();
msg19.width = stage.stageWidth;
msg19.height = stage.stageHeight;
[code]....
View 2 Replies
Feb 9, 2011
I have a situation where i have a horizontal scrolling container that has a video object inside it. the video object has to stay inside the scrolling content for another reason i don't want to get into here. Now the client wants me to keep the video in the center of the stage even when the clip its inside of is scrolling. Normally I would just take it out of the scrolling clip and place it above the scrolling content but i cant do that here. I tried this math but it didn't work exactly. on an enter frame when the video is open I have this code;
Actionscript Code:
if( vid ) vid = ( stage.stageWidth/2 - vid.width/2) - scrollingContainer.x;
View 4 Replies
Jan 21, 2009
up/down/right/left) except for zooming around the center of thestage. Let me explain, the user can drag the map in any directionany number of times but whenever they zoom in/out whichever pointof the map is in the center of the viewable area should always stayin the center.So for example I have several zones in my map, like Zone 1,Zone 2, Zone 3, etc. Let's say the user wanted to examine Zone 1more closely so they move the map in such a way that Zone1 nowappears in the center of the viewable area. I want when they zoomin/out Zone 1 to always remain in the center.
So I have the Map as a movie clip symbol and as a buttonsymbol. In Scene 1 of my Flash document I've inserted the Map movieclip and inside of the movie clip I have the Map button. In Frame 1of the layer where my map is I have the code for moving and zoomingin/out. Here is what it looks like below.
View 1 Replies
Jun 6, 2010
When I preview my site on the internet, it's on the top left corner. Is there a way to make it top center??
View 16 Replies