ActionScript 2.0 :: If Statement - Return Back To Zero When This._x Reaches 400 Pixels On The Screen
May 7, 2008
Been a while since i touched actionscript and forgot a simple If statement using _x. THis is the code that I have.
Code:
onClipEvent(enterFrame) {
this._x = this._x +.5;
}
Now when this._x reaches 400 pixels on the screen, I want it to return back to zero. How do I do that again?
[Code]....
View 4 Replies
Similar Posts:
Sep 20, 2008
I hope the following is pretty self explanatory. There is a ball movie clip "mc1" on stage. The addEventHandler simply starts a tween and the ball rolls from left to right until it's off the stage. I'm simply trying to make the clip stop when it reaches a certain x value on stage. I'm trying to teach myself simple techniques for the if statement and loops.
[Code]...
View 13 Replies
Mar 3, 2003
Is there a function or method in ActionScript that can return the # of pixels used?
View 3 Replies
Nov 2, 2006
making an object move from one side to another by using actionscript. so now i was wondering how to make the box get back into the same place as it started when it reaches a certain point.
dding the code to this AS i already got:
Code:
onClipEvent(enterFrame) {
speed = 5;
this._x += speed;
}
View 3 Replies
Jan 15, 2009
[Code]....
instead of moving to 'distance' and staying there, the MC moves back and forth once it reaches it's destination. this is because even when _x = distance, the first if statement (_x<distance) keeps executing. At first I thought this didn't make any sense, and there has to be a reasonable explanation. I've managed to isolate and even solve the problem, but the mystery remains:
[Code].....
View 1 Replies
Mar 7, 2007
My target MC jumps back and forth when it reaches the endX and endY.?
Code:
movement = function (moveIsActive, target, endX, endY) {
if (moveIsActive) {
a = Math.atan2(endY-target._y, endX-target._x);
[Code].....
View 3 Replies
Jan 13, 2009
I have a project (see attached) where I need to have the folders seem like they are floating in space, and I need the best way to make it so when you click on a back folder, it slides off the screen and come back in front of all the folders.
View 2 Replies
Feb 9, 2011
I have a Flash object that I need to embed in a page, and I've got it in a wrapper div that is styled to the exact width of the object: 323px. The problem I have is that when I zoom the whole page in the browser (for example, by using ctrl+mouse wheel, or ctrl++ or ctrl+-, the wrapper div zooms, while the flash object does not. Is there a way that I can specify a width in physical screen pixels, so when I zoom in or out, the wrapper div stays the size of the Flash object?
View 1 Replies
Oct 24, 2002
I want to make a box come from off screen then bounce back and forth and then come settled down in the middle of the screen. It can be random bouning intervels or a set amount.
View 6 Replies
Dec 13, 2007
Some images I load dynamically are too big so I would like to scale them to fit the stage.
[Code]...
this returns 0. Why does it return 0 when the image loaded is obviously much larger then 0 pixels. How do I change the width and height of imgCont to a specified dimension.
View 1 Replies
Feb 17, 2012
I'm just trying to make a simple function that will return all the data from my SQLITE database as an array. But it looks like when my function is returning the array, the SQL statement is actually still executing... so it's empty... Does anyone have a suggestion? Or am I just going about this whole thing wrong.I know I could just have the event listener functions outside this function, and they could then set the data. But i'm trying to make a AS3 Class that holds all my SQL functions, and It would be nice to have everything for this particular function just in one function, so it can return an array to me.
public function getFavsGamesArray():Array
{
getFavsArraySql.addEventListener(SQLEvent.RESULT, res);
[code].....
View 2 Replies
Feb 2, 2006
I just want a function to return true, but after a LoadVars.onLoad.event. Am I right in assuuming that the return in the onLoad = function below relates ONLY to that function? What I want is for the sendLockCheck()to return true depending on the if statement within the onLoad.
function sendLockCheck() {
var lockCheckResult_lv:LoadVars = new LoadVars();
var lockCheckSend_lv:LoadVars = new LoadVars();[code].....
View 2 Replies
Feb 26, 2010
how do you do the following
A movieclip is playing...
When it reaches frame 20, it goes back and plays at frame 5. Then it keeps doing this. To me this is harder than it looks
View 6 Replies
Jan 2, 2011
I was wondering if you could help me. I was trying to make a 'make-your-own-face-game', and succeeded, except one thing. When you click on a button to see the options for hair, the four buttons come from off the stage to on the stage by changing their x and y attributes. But then when they click the button to see the options for hair a second time, i want them to return off of the stage, and am getting problems. No syntax or as3 problems, but they wont go back.
[Code]...
View 11 Replies
Oct 22, 2003
This is what I get in the output window:
Statement must appear within on handler
back_button.onRelease =function () {
View 6 Replies
Sep 28, 2008
how can i drag parts of a pazzle and drop them in the rihgt position? if the posision is wrong i want (the piece) to return back to its start posission.
View 1 Replies
Oct 26, 2009
How do you read the RGB values of a webpage's screen pixels directly underneath of a Flash widget?
View 1 Replies
Oct 7, 2009
I have a timeline that has some label frames at the very end of the timeline. During the timeline a user will hit a button on a frame and will jump to one of the label frames. On the label frame is another button that when clicked - returns the user to the previous frame. How do I make the movie return to frame 1 - without a button - but before it reaches the label frames? In other words, by simply reaching a certain frame in the movie, I want the timeline to go back to frame 1.
View 3 Replies
Jun 23, 2009
I have two functions in an ActionScript class, they are:
private function loaderCompleteHandler(event:Event):void
{
_loader = Loader(event.target.loader);
selectedBitmap = Bitmap(_loader.content);
[Code].....
Is it possible to send the selectedBitmap variable back to the byteArrayToBitmap function after the event completed?
View 1 Replies
Apr 24, 2008
Basically, I have a flash app with various frames, each frame contains a "help" button, which when clicked takes the user to one seperate frame with various informative instructions on it. The help button is like a universal tool incase the users need help.
Now, no matter what frame the user is on, if they click the help button, sure enough, it takes them to the "help" frame. The big problem I have, is that I cannot fathom a way to make the users RETURN to the exact frame they came from.
For instance, the user is viewing a frame in the app called "Question 2", they get stuck, they click on the "help" button, it takes them to the "help" page. After veiwing the instructions, they need to return to the question 2 frame, possibly by clicking a "back" button of some description. Likewise if they were on a frame called "Question 3" - they need to return to this frame if they click the help button.
In a nutshell, I need to create a button that takes the user back to the previous frame from the "help" frame, like a dynamic link back or something.
View 9 Replies
Nov 23, 2010
im using cairnform framework as3 and i have a single swf file, and i m searching a while for back button to go back a previous screen with all data's which r there previously.
View 0 Replies
Mar 24, 2012
so instead of the pixels being dissolved, the pixels being added? :
ActionScript Code:
var Anim:TransitionManager = new TransitionManager(blackbox);
Anim.startTransition({type:PixelDissolve, direction:Transition.OUT, duration:1, easing:None.easeOut, xSections:35, ySections:35});
basically what i would like is the end point to be the start point and the start point the end point.
View 2 Replies
Jun 17, 2009
I have a swf file that loads into my main movie, and within that swf there is a masked image that i would like to scale using zoom in and out buttons and also by using a slider bar.However i cant find any tutorials that will allow me to combine the two.I have used the following code for the buttons. Which seems to work ok but i would like it to be a little smoother. (using speed or some sort of easing??)
ActionScript Code:
zoomPlus.onRelease = function(zoomIn) {
if (test_shirt.shirt._xscale == 400 && test_shirt.shirt._yscale == 400) {[code]....
but for this code it keeps shrinking my initial object down to 10 pixels by 10 pixels..
View 0 Replies
Nov 18, 2009
I have a movie clip called column1_mc. when I click a button I need to move the movie clip in incremental moves consisting of 30 pixels.
column1_mc._y = 30;
Does not work because that is giving a _y coordinate.For example.I need to make the movie clip jump to _y 300 but make 10x30 pixel incremental jumps. Moving 10 times 30 pixel jumps.
View 1 Replies
Jan 29, 2008
If this is possible to detect if a user's display resolution is less than 1024 x 768 as a flash projector file is launched - then depending on the result I want to select one of the following commands to ensure that no cropping occurs of my final file:
fscommand("allowscale", "false");
fscommand("allowscale", "true");
View 5 Replies
Nov 25, 2011
This is an if stament on a frame on the root. I want to loop Carrera(a lenghthy movieclip) from frame 2 back to frame 1. (For testing purposes) This is the code:
[Code]...
View 3 Replies
Feb 15, 2011
I've created next/back buttons to navigate to various frame labels on the timeline. There is a "main menu" frame that contains menu buttons to take the user to other frame labels on the timeline. However this "main menu" frame has an FLV playing and needs to be "stopped" when navigating to another frame label. I have the code for this.
What I am inquiring about is this:Do I need to create an "if statement" in the next/back button code telling Flash that if the user clicks on the next/back button while on the "main menu" frame, to stop the FLV also?
View 4 Replies
Apr 15, 2010
The key event is not listened by my Flex app. Since it is really simple code, I cannot understand where the problem is...
init() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, escHandler);
}
[Code]....
View 1 Replies
Aug 14, 2010
I have an animated storybook that reader moves through each page (scene) with forwardBtn and backBtn. Each scene (in it''s own keyframe) I have placed a voiceover on the time line. When I view movie the forward btn plays scenes and sound correctly. The prolblem is with the back btn, When bacBtn in pressed the previous scene plays but the sound from the other sceane keeps going.actions from back btn below
on (keyPress "<Up>") {
// Locate the screen that is the target of the behavior
var screen = null;
[code].....
View 5 Replies
Jan 30, 2012
1: When I get back to my main game screen, how do I keep my MovieClip in the same place it was before.
2: When I run this code:
Code:
if(numberOfGras**** == 1){
mcGrass1.visible = false;
mcMonster.removeEventListener(Event.ENTER_FRAME, TouchingGrass1);
}
It makes mcGrass1 disappear, but not the event listener. When I touch the area where it was, it still goes to the screen "math". [URL] That is the location of my .fla
View 1 Replies