ActionScript 3.0 :: Moving MovieClip And Completing Loop
Apr 2, 2010
For some reason the x++ loop to move clip doesn't work. There must be an easy fault.
cX=iButton[i].x;
while (cX>iX) {
iButton[i].x=cX;
cX--
}
It should move a thing smoothly, as I understand it, but it doesn't. It completes the while and then shows the iButton at iX, completing the loop without showing a thing meanwhile. I even put a 1000-count for{} loop to slow it down, but it just delayed the final outcome. I also tried to move the moving to a separate function, and into a package. (It's these menus I want to slow down.)
View 3 Replies
Similar Posts:
Sep 14, 2009
what to know how to move the x value of menuButton. The rest of the code is working fine
Code: Select all var currentX:Number = _level0["menuButton"+i]._x;
//next button try to move left (not working)
_level0.attachMovie("next", "nextButton"+i, _level0.getNextHighestDepth());
var btnxt = _level0["nextButton"+i];
[Code].....
View 5 Replies
Nov 24, 2005
I've got this space background image that you can move around with the arrow keys. What I'm trying to accomplish is kind of hard to explain so I'll just give an example...
First, look at the SWF and move the background in any direction. You'll notice that the actual image is pretty small, just barely bigger than the stage itself. I want to make a script that will create duplicates of this image and place those duplicates in the right place so that you will never see the empty white space.
Ok, so say you hold down the right arrow key.. and the image moves left. Once the right edge of the space graphic touches the right edge of the stage, i want a duplicate of the picture placed so that the left edge meets the right edge of the original graphic. Keep holding right, and eventually the original graphic will be pushed off the stage. I'd then like for that graphic to be removed, and for the whole process to repeat itself while moving the picture.
View 1 Replies
Apr 16, 2011
I am trying to make a simulation of a blood moving in an artery and I want blood cells to continuously be moving across the stage ( so that there are no gaps in between one loop and the other) when i click the start button.I thought about doing a setinterval loop but it just overwrites the previous set of generated mcs? This is the code on my button
on (release) {
var years:Number = 80;
function generatePlatelet (){
[code]......
View 2 Replies
Apr 28, 2010
I'm trying to load an external swf file that will be used as a system.
[Code].....
Now, the progress handler is tracing out that the file is being loaded, but it never triggers the the Event.COMPLETE event. Tracing out the Loader.loaderInfo returns null in functions.
View 8 Replies
Apr 8, 2009
Have recently made a few educational activities which are experiencing performance problems on older machines. Basically, tweens are not completing and causing things to behave strangely.I don't think it's the well-known garbage collection problem with tweens not completing as I use TweenMax for all the tweens. Also, on any half-decent machine, everything works correctly but if tested on an old laptop it all goes a bit wrong.
EDIT: I've not got around to adding a pre-loader yet so things might take a while to download..
View 2 Replies
Mar 17, 2010
So i have a drag and drop game that has five answers that you drag to each approriate question. What I'm trying to do is, after they successfully dragged all of the answers to their questions, a button appears which allows the users to proceed onto the next part of the module.
View 12 Replies
Feb 5, 2011
Is there a bug in the as3 tween class that causes tweens to stop before completing. I read that there is and that a 3rd party tween class should be used. I'm just starting out learning as3 and experimenting but this would be good to know when I move onto more complex projects. Also the solution for this was to make your function global. Does this simply mean place your function in the top level of your movie.
View 5 Replies
Aug 29, 2010
I'm in the midst of creating a Bumptop styled selection tool. Right now I got as far as creating the tool itself (which actually works pretty good) and spreading some random square items on the stage. This is the class that creates the selection tool :
[Code]...
View 1 Replies
Jan 15, 2012
I am attempting to make an app in which you can load an image file from your computer or from a URL. I have the computer file part working fine, but am having an issue when I'm trying to load an image from a URL. Here is the code:
[Code]...
The problem: After the load is requested, it doesn't call any of my events. There are no errors and there is no loading. You can see from this code a snippet of things I've tried to see if there is an error. urlFile.text is a string returning from my flex textInput. I put in a hard coded string instead of the urlFile.text and that did not work. I changed to a URLLoader instead of a base Loader, and that sort of worked (it completed the load) but I couldn't do the image manipulation afterwards that I wanted to do, and I saw in other posts here that a Loader is the correct thing to be using.
View 1 Replies
Sep 15, 2009
I am loading files via flash+php and I can't get the progress bar or completing event to work....and I am sure the solution is simple.
ActionScript Code:
System.security.allowDomain("http://ftp.fakename.com/");
import flash.net.FileReference;[[code]..........
View 0 Replies
Jul 18, 2010
I'm having some problem with a alpha tween, it works well when loading pictures then fades them IN and OUT but when I load a movieClip it only fades IN to, maybe 50%, the video object remain transparent. When I CLICK in other button before fades OUT, the movieClip fades to 100% and then it fades OUT.
The project is a XML gallery that loads images and movieClips (all external), the movieClips work like a container to one image (like the other pictures gallery) and one Youtube video (that remains over the picture).
If I remove the fadeIN tween all works fine, I think the problem was in the Timing of code compilation but I can't solve it out.[code]...
View 3 Replies
Dec 9, 2010
I'm trying to create the following application:There are 5 different (non overlapping) MC's placed on a still background. They each represent a parcel that will unwrap itself by clicking the corresponding button (invisible button laying over the MC). I want to accomplish two things:1. The viewer must be able to click each of the buttons at random, which should leave each of the buttons disabled after the first time being clicked. A parcel should only unwrap itself once.2. As soon as the last of the 5 parcels has been unwrapped (Each MC stops automatically: actionscript on last keyframe MC), a new MC should start playing automatically (continuing the application). Thus without having to click anything additionally.I hope there is somebody who can make any sence of what I have tried to explain.
View 5 Replies
Feb 12, 2010
I am writing a peer-to-peer binary socket program. There are only two endpoints. One socket is listening on my laptop system. The other socket is broadcasting from my desktop system. I have a third program running on a hosted server, that is available to broker the connection between the two. My problem is that when the laptop and desktop are on the same network, they both have the same internet IP address but different intranet IPs, but when the laptop is on the road, then the IP addresses are different. In order to be truly peer-to-peer, I have to write it so that after the connection is established, that the two computers communicate directly between one another. How is this generally accomplished, when the two computers could potentially share the same IP address, if they are running on the same network?
View 1 Replies
Mar 26, 2009
The function shown below is trying to take data from a text input and refresh the data displayed. I am trying to get it to do so when the enter key is pressed. But it only refreshes on the second time enter is pressed. The "Enter pressed" is traced twice, but the "Enter Frame" is only shown after the second "Enter pressed" trace.
Code:
trace("Enter Frame")
function locRefresh(evt:KeyboardEvent) {
[code]......
View 4 Replies
Mar 18, 2005
I'd attached one preloader.zip file in that there is FLA and SWF file is there now when you run the source file after completing the preloader to 100% it load test.swf file, now you export the file to preloader.swf and when you will run the preloader.swf file it will run properly but when you put this preloader.swf file into html file and after that you open this html file what will happen that after loading 100% preloader it will not to load test.swf file from html file.
View 3 Replies
Mar 7, 2009
I have a main MovieClip in which I have several frame labels, each will eventually have different MovieClips associated with them. First time through I want to play an "intro" MovieClip, which I have placed on the stage at the begining of the main timeline, then at the end of the "intro" Clip, go to the first frame label and play that MovieClip.
The way I was going about it was placing this code in the last frame of the "intro" MovieClip:
Code:
MovieClip(parent).screen_mc.gotoAndPlay("home");
'screen_mc' is the instance name of the Main MovieClip.
[URL]
View 3 Replies
Nov 26, 2008
Im currently making a game that has one of those old-skool Fallout maps (a world map where you click somewhere and the "you" marker moves there) that im trying to replicate.I already have the scripts ready for map interaction (using onhit here). But i was wondering if someone could help me with a script that works this way:
1. I have a movieclip (the character)
2. When i click somewhere on the map i want this movieclip to move there. Not instantly but moving over the screen to that point where you clicked.
3. I also want there to be passages that when the movieclip hit that movieclip (named hit for example) it stops dead and doesn't move (will be used on the map for mountains and such) and the player has to click somewhere else to move it that path (im assuming this will be something like onhit: hit - speed=0 something but im not a good scripter and it would had to be worked into the script.
4. ok this one is kinda optional but would be great! If it's possible to have it worked in the script that when the clip doesn't move (and is stationary on the map) the movieclip stays on frame 1 but when the movieclip is in motion (and moving across the screen) the movieclip is on frame 2 (and reverts to frame 1 when it's not moving anymore and so no)
View 15 Replies
Aug 9, 2010
I have a movieclip that I want to move down and up.I use a new tween using the Elastic. easeOut property to move the movieclip down over a duration of 2 seconds.But right after it moves down I need to move it right back up so it looks like a uniform animation.I used setInterval(reverse,2000) and reverse contains yoyo();This almost works.Since Elastic slows down the movement of the movieclip at the very end, there seems to be a pause between the movieclip moving down and the movieclip moving up.It does not give the impression that it is 1 tween, which is what I was going for.I tried to set the duration to less than 2 seconds, but then Elastic property is not 'stretchy'.It is too fast and comes to a halt, not elastic, and then the reverse (when the movieclip goes back up) is much faster than when the movieclip goes down.Is it possible to move the movieclip down AND up by using just 1 "new tween" function?
View 2 Replies
Oct 25, 2006
I have a movieclip that I want to move down and up. I use a new tween using the lastic.easeOut property to move the movieclip down over a duration of 2 seconds. But right after it moves down I need to move it right back up so it looks like a uniform animation. I used setInterval(reverse,2000) and reverse contains yoyo();This almost works. Since Elastic slows down the movement of the movieclip at the very end, there seems to be a pause between the movieclip moving down and the movieclip moving up. It does not give the impression that it is 1 tween, which is what I was going for. I tried to set the duration to less than 2 seconds, but then Elastic property is not 'stretchy'. It is too fast and comes to a halt,not elastic, and then the reverse (when the movieclip goes back up) is much faster than when the movieclip goes down. Is it possible to move the movieclip down AND up by using just 1 "new tween" function? I am out of ideas.
View 2 Replies
Jun 4, 2004
I want to rotate an object in AS because i think moving it manually is a waste of time
View 1 Replies
Nov 17, 2002
how to make the scroll/list menu in 2advanced's portfolio section, it can be found here [URL]
I kinda had a idea on how to make it , by using a mask and movie clip which holds the buttons, and then just use the up and down buttons to move the movie clip up and down, but dnt really know how to really do this.
basically want to know how to move a Movie clip up and down when a up or down button is pressed with restriction to how much i can move it up and down,
View 12 Replies
Jan 12, 2009
I have a movieclip that I am moving behind a mask to achieve a panning effect. I am able to move my movie clip onRollOver and stop onRollOut. So far so good, except that I have no boundaries or margins on my movie clip so when I keep my mouse on my button, my movieclip continues to move indefinitely forever. Can someone please tell me how to set boundaries on the left and right or how to limit the scrolling to an X -1000 and X +1000?
[Code]...
View 1 Replies
Mar 11, 2009
Basically I need to have a cartoon character walking to the right hand side of the screen and then turning around and moving back to the left hand side and so on.
I have some code done but it could be all wrong as I am not the best coder at all, just starting out.
Code:
package classes{
import flash.display.MovieClip;
import classes.RollableChar;
public class MainApp2 extends MovieClip{
//public var theCharacter:MovieClip;
//public var myCarrot:RollableChar;
[Code] .....
View 1 Replies
Sep 29, 2010
I'm exploring menu's in flash and I'm currently trying to put together a thumbnail menu where thumbnails are contained in a Parent MovieClip.I want to then be able to move that movieclip along the stage (to the left or right, depending on the keyboard key pressed)..I know I can do this using this code, when the Parent MovieClip
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);function myKeyDown (e:KeyboardEvent):void{
if (e.keyCode == Keyboard.RIGHT){my_mc.x -=125; }
[code].....
View 5 Replies
Jan 30, 2012
In my attempt to create a simple Pong-like game, I've encountered a very strange and at times severe visual bug.When I set the ball (A Flash CS 5.5 library MovieClip) in motion moving around the screen at a rather fast speed, I've noticed that sometimes the edges of the ball would be cut-off for a short moment in the direction it is moving.
When it happens, it almost seems like the position of the ball MovieClip is slightly ahead of its own border and thus the part that is outside the border fails to get drawn.
Here's a picture that illustrates how this looks - at least for me:
You can also view the .swf file online here: [URL]
Some technical data:
I've been unsuccessful in capturing the with a screenshot no matter how much I tried. Sometimes I would open the .swf and the bug would be almost non-existent while at other times it was very blatant. I'm using an EnterFrame event function to increment / decrement the x and y position of the MovieClip. I have never encountered any such problem in any Flash app, in this machine or others. Truncating / rounding the x and y values of the MovieClip didn't help. Neither did setting cacheAsBitmap to true.
View 1 Replies
Aug 10, 2009
On the main timeline I've got solar_mc also On the main timeline I've got planet_mc and inside planet_mc I've got pluto_mc.. In pluto_mc. the actionscripts are writen to display text info, change colors, mouseovers, etc... My problem is the actionscript written in pluto_mc makes moon_mc, crib_mc and hale_mc on the main timeline function (changing it's colours, information, etc...). But I need to move moon_mc, crib_mc and hale_mc to solar_mc. When I do so the pluto_mc action script does not work! How can I put moon_mc, crib_mc and hale_mc in to one mc (solar_mc) and still make the actionscript in pluto_mc work? I've used the _root. command in the script pluto_mc..
View 2 Replies
Jan 26, 2010
I've boiled this down as simple as I can make it. When I click on the down movie clip (which is inside the MC movieclip) it does indeed move the MC movieclip down 20. However, I need it to also move the "enemy" movieclip down. When I try running this I don't get any compile errors but when I click on the "down" and the MC moves down I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
[Code]...
View 3 Replies
Oct 6, 2010
If I have a movieclip moving random around the stage, and I have another movieclip I one corner. is it possible to add an event listener to listen after if the random moving movieclip comes over the other movieclip?
View 1 Replies
Aug 20, 2009
I'm currently working on a GUI design and for the options, instead of a slider I want a movie clip that fills 5 boxes or empties the boxes when i hit the plus or minus buttons I've made. I created a movie clip called bars which has 6 frames. Then I made an addbar button and a subbar button. I then created a movieclip with all three items inside of it called gauge. I set the actionscript to the gauge movie clip. This is what code I have in currently. When I play the swf the boxes remains empty and will not move through the movie clip of bars like I want.
guage.jpg (23.8 KiB) Viewed 231 times
View 1 Replies