Control Movement/turn
Hello Everyone, i need help in controling the turn of action.Example: i moved an object a certain distance.once it reaches a distance then it stops.** i want to have a button; when you press will allow you to move the object again for the same distance.(what is code to do that).....then will need press button to allow it to move again.thank you
KirupaForum > Flash > ActionScript 3.0
Posted on: 12-30-2008, 09:52 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Control Movement/turn
Hello Everyone,
i need help in controling the turn of action.
Example:
i moved an object a certain distance.
once it reaches a distance then it stops.
** i want to have a button; when you press will allow you to move the object again for the same distance.(what is code to do that).....then will need press button to allow it to move again.
thank you
Control Movement/turn
Hello Everyone,
i need help in controling the turn of action.
Example:
i moved an object a certain distance.
once it reaches a distance then it stops.
** i want to have a button; when you press will allow you to move the object again for the same distance.(what is code to do that).....then will need press button to allow it to move again.
thank you
Movement Control
I use flash to build a small boat slowly sliding on water (left to right or r to l). I want to use script to control movement instead of each frame. Could you help me to figure out how I can use script to control this horizontal slowly moving from left to right? If you can provide a small sample for download that should be very helpful.
Thanks!
Keypress Movement Control
I'm making a gamepiece go from square to square on a checker board. I can make make it move from square to square by setting an X or Y movement value in conjunciton with a keypress, but I want it to slide smoothly, not jump from location to location. Any ideas?
MC Control And Movement.. This Should Be Easy
I am using flash MX 2004 and am struggling with a bit of actionscript. I am just beginning to get to grips with actionscript but do not fully understand it... here's my problem:
All I want to do is make one MC (a) move down by about 20 pixels when the mouse is over another MC (b), and when the mouse rolls off the MC (b), then MC (a) returns to it's original place.
I need to tie the above in with this actionscript:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
I have been trying things like:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
movieClipa.x = -20, y=0();
}
}
the main thing I need to know is the correct actionscript for moving objects on the x and y axis. The bit in italics above is where I have not got a clue what I'm doing.
Help!! I'm sure this should be easy enough!!!!!!
Movement With Speed Control
How would I create car movements with speed control?
I tried following THIS Tutorial. But when I play the movie/game, it only rotates my car. It wont go forward.
I have my Fla.
Control The Speed Of Movement
hi, the following code i collected from variant tutorials, it works for me. but i don't know how can i change the movement speed of the balls. please help!
SH = Stage.height;
SW = Stage.width;
numBall=10;
dampCollision=1;
ballRadius = 20;
ballWidth =(ballRadius*2);
MovieClip.prototype.handleCollisions = function()
{
for (var i = mcs.length-1; i >= 1; --i) {
for (j = i-1; j >= 0; --j)
{
if (_root.mcs[i].hitTest(_root.mcs[j]))
{
var x1 = mcs[i]._x;
var y1 = mcs[i]._y;
var dx =mcs[j]._x - x1;
var dy = mcs[j]._y - y1;
var dist = Math.sqrt(dx*dx+dy*dy);
var mag1 = Math.sqrt(mcs[i].vx*mcs[i].vx+mcs[i].vy*mcs[i].vy);
var mag2 = Math.sqrt(mcs[j].vx*mcs[j].vx+mcs[j].vy*mcs[j].vy);
mcs[j].vx = (mag1*dx/dist)*dampCollision;
mcs[j].vy = (mag1*dy/dist)*dampCollision;
mcs[i].vx = -(mag2*dx/dist)*dampCollision;
mcs[i].vy = -(mag2*dy/dist)*dampCollision;
}
}
}
}
MovieClip.prototype.moveBall = function()
{
this.vx *= 1;// damping due to air resistance
this.vy *= 1;
this.vy += 0.5;// gravity
// bounce off floor and ceiling
if (this._y+ballRadius + this.vy >= SH ||
(this._y-ballRadius) + this.vy < 0)
{
this.vy *= -1;
}
// bounce off right and left walls
if ((this._x-ballRadius) + this.vx <= 0 || this._x+ballRadius + this.vx >= SW){
this.vx *= -1;
}
this._x += this.vx;
this._y += this.vy;
updateAfterEvent();
}
mcs = [];
for (var i = 0; i < numBall; ++i) {
var mc = this.attachMovie("ball", "mc"+i, 1+i);
mcs[i] = mc;
mc._x = ballRadius+random(Stage.width-ballWidth);
mc._y = ballRadius+random(Stage.height-ballWidth);
mc.vx = Math.random()*32-16;
mc.vy = Math.random()*32-16;
mc._width = ballRadius*2;
mc._height = ballRadius*2;
mc.onEnterFrame = mc.moveBall;
}
_root.onEnterFrame = handleCollisions;
Using The Keyboard To Control Movement
As a beginner i am finding flash quite difficult to use, please help.
I am want to use the up/down arrow keys to control a paddle in my pong style game. My version is FlashMX.
To control the mouse bat i have used the script below where Bat is the instance name.
function moveBat () {
bat._y = ymouse;
}
i assume it is very similar but i'm not sure where to start. Any help would be much appreciated.
Thanks
Control Frame Movement
Ok, I am a beginner, and I want to make a basic picture slide show. The best way I thought to do it was to have every picture in its own frame, and have a "next button" that when pressed will move to the next frame (picture).
So, I have the button ready, as well as all the pictures in the frames, but I don't know how to do the action script part. Basically, first I have to stop the frames from changing automatically, then on a button press go to the next one.
Thanks.
Using Slider To Control Movement
Hi all, I would really appreciate some help figuring this problem out. I'm trying to build a scrubber to control the movement of some movieclips. My code now uses the up and down keys in an onEnterFrame to increase or decrease "vz". This is working fine, and my movieclips move using: dream.z += vz; This is the line of code I need help with to make my scrubber work. Does this make any sense? I posted this once, but I've tried to strip the code down to make it easier to read in the forum. The scrubber should zoom the dream clips in when you slide it all the way to the right, and the zoom the dream clips out to the original position when you slide it back to the left.
................//mover function
function mover():Void {
if (zdepth < 55 && Key.isDown(Key.UP)){
vz -= .5;
zdepth += .5;
}
if(zdepth > 0 && Key.isDown(Key.DOWN))
{
vz += .5;
zdepth -= .5;
}
vz *= friction;
for (var i:Number=0;i<dreamarray.length;i++) {
var dream:MovieClip = home["dreamarray" +i];
//this next line is what i need help with
dream.z += vz;
var scale:Number = fl / (fl + dream.z);
dream.swapDepths(-dream.z);
}
}
}
.......................//scrubber code...................
var scrubber:MovieClip;
var track:MovieClip;
scrubber.onPress = function(){
this.startDrag(false,0,this._y,track._x + track._width,this._y);
this.onEnterFrame = function(){
trace(this._x);
_parent.vz = -(16*this._x) / 300;
}
}
scrubber.onRelease = function(){
this.stopDrag();
delete scrubber.onEnterFrame;
}
scrubber.onReleaseOutside = function(){
this.stopDrag();
delete scrubber.onEnterFrame;
}
Random Movement Control
Dear People I have a question is it possible to control Random Movement by mouse (random><control :-) I mean on Mouse over make items/movie clips go from random woundering in to certain position and play next frames? I would like to make signs which looks like vertical lines moving from left to right at random and when you drive mouse over lines go to the certain positions and rutn in to the letters. So, you can observe like lines transform in to the letters without jumping.
Thank you very much
peter.applerock@mail.ee
Control Carousel Movement?
http://www.joshkneedler.net/fuse/basicMove7.html
i'm working with some carousel movement and am trying to figure out how to add a level of interactivity beyond simply reacting to the _xmouse position.
when pressing prev or next i want to go into a mode where the objects cycle through positions on the ellipse.
i was thinking the fuse kit would be a good solution which is what i tried here:
http://www.joshkneedler.net/fuse/basicMove7.zip
but i don't think i'm on the right track. any tips or suggestions would be appreciated,
thanks,
josh k
Keyboard Keys Control Movement
Me and my friend are going to make a fighting game in flash and i cant seem to find a tutorial on how to let the key board keys to control movement like if i want certain letter to punch and kick and jump and so on if any one knows how to do this please IM if u have aim and tell me over that or just post it in here thanx
Mouse To Image Movement Control
This is a question regarding being able to control the position of an object in the canvas relative to the movement of the mouse cursor.
We're trying to have this graphic react to the mouse, so for example when one mouses upward the graphic starts to gradually [de] accelerate downwards, and viceversa.
What kind of actionscripting should I use, or how does the code for such a thing looks like?
Thanks
iam2001
Mouse To Image Movement Control
This is a question regarding being able to control the position of an object in the canvas relative to the movement of the mouse cursor.
We're trying to have this graphic react to the mouse, so for example when one mouses upward the graphic starts to gradually [de] accelerate downwards, and viceversa.
What kind of actionscripting should I use, or how does the code for such a thing looks like?
Thanks
iam2001
Flash In Kiosk Mode - Turn Off / Turn On Launch Schedule
Hi Forum
I am creating a little flash app for a kiosk. We will be using a Mac. (not sure about OS yet, but probably 10.4 or up. )
1) Is there a way to automatically launch the flash app on startup on a mac?
2) Is there a way to schedule a shut off and launch time on a mac? We'd like the machine to automatically shut down at midnight and relaunch at 7am for example. Is there an application that handles tasks like these built in the OS or is there some application out there that would handle this?
Any advice or insight appreciated.
Thank you
Best
Stephan K
Drag Movement Restrictions And Mc Timeline Control
Hey guys.
I was wondering cause i have a movie clip called leftleaver_mc and ive made it dragable with the following codes.
this.leftswitch_mc.onPress = function() {
leftswitch_mc.startDrag()
}
this.leftswitch_mc.onRelease = function() {
leftswitch_mc.stopDrag()
}
that code obviously works but i what i want to do is make it so they can only drag up and down between the y coordinates of 990.1 and 793.8 on the stage and also not beable to move from the x coordinates of 276.4 while there dragging up and down.
================================================== ====
also another thing is when there moving the the leftswitch_mc up and down between them coordinates i want it to control an animation ive made in another mc called testcylinder_mc like the frame lable i want it to control in the cylinder mc is around 30 frames long starting at frame 6 of the mc's timeline and if they movie the leftswitch_mc up i want it to play that frame forward at normal speed and if they move leftswitch_mc down i want it to play that frame in reverse at normal speed and also if leftswitch_mc is at its original starting point i want the cylinder mc to return to frame 1.
thanks for reading i hope ive exsplained it easy for u guys to understand and to beable to help.
thanks in advanced
Scrubber Instead Of Arrow Keys To Control Movement
I have a "mover" function that controls the MovieClips named "dream." It is being called with:
dream.onEnterFrame = mover;
Right now, the up and down arrow keys are incrementing the vz value in the onEnterFrame. I'm also incrementing a variable zdepth (arbitrary) to limit how far z can zoom in and out. I'm trying to create a scrubber (instead of the arrow keys) to control the z movement of my dream movieclips. My scrubber code is:
var scrubber:MovieClip;
var track:MovieClip;
scrubber.onPress = function(){
this.startDrag(false,0,this._y,track._x + track._width,this._y);
this.onEnterFrame = function(){
trace(this._x);
_parent.vz = -(16*this._x) / 300;
trace(_parent.vz);
}
}
scrubber.onRelease = function(){
this.stopDrag();
delete scrubber.onEnterFrame;
}
scrubber.onReleaseOutside = function(){
this.stopDrag();
delete scrubber.onEnterFrame;
}
my current mover function is:
function mover():Void {
if (zdepth < 55 && Key.isDown(Key.UP)){
vz -= .5;
zdepth += .5;
trace(vz);
}
if(zdepth > 0 && Key.isDown(Key.DOWN))
{
vz += .5;
zdepth -= .5;
trace(vz);
}
vy -= gravity;
vx *= friction;
vy *= friction;
vz *= friction;
for (var i:Number=0;i<dreamarray.length;i++) {
var dream:MovieClip = home["dreamarray" +i];
dream.x += vx;
dream.y += vy;
dream.z += vz;
if(dream.y < 50)
{
dream.y = 50;
vy = 0;
}
if (dream.z <= -fl) {
dream.z._visible = false;
}
else
{
dream.z._visible = true;
var scale:Number = fl / (fl + dream.z);
dream._xscale = dream._yscale = scale*100;
dream._x = vpX + dream.x * scale/2;
dream._y = vpY + dream.y * scale/2;
//dream._x = dream.x * scale/2;
//dream._alpha = scale * 60 + 40;
dream.swapDepths(-dream.z);
}
}
}
The arrow keys work, but my scrubber only works in one direction. I need some help with the logic here...so the slider can be used to zoom into a set value, then zoom back out to the original value. vz values seemed to range from -16 to 16 with the arrow keys, so i tried to write a formula to create a ratio from the width of the scrubber track to those corresponding vz values.
When the scrubber is at 0 vz=0
When the scrubber is at 300 vz=-16
I'm sure my mover function needs to be changed, but I could use a little help.
How Do You Control The Movement Of The Frames? Forward/Backwards
Hello all, I've been trying to figure out how to do an scrolling easing menu but instead of using xMove I have a continuous scrolling animation(from left to right) composed of keyframes instead. Does anyone have an idea of how I would script this? I'm totally lost, I'm trying not to use a goto trace function to keep the animation from being jerky. I'm not really sure where to begin with this.
1. determine whether the target that is chosen makes the frames go forward or backwords.
target = 1;
dir = "f";
incremental = function() {
if (target < current) {
dir = "f";
} else if (target==current) {
bar:dir = "null";
}
goto = (String(bar:direction+bar:current));
trace(goto);
}
2. Um I'm not really sure what after lol. I was thinking of making(althought i wouldn't know how=) a function that plays +1 frame until the target object variable is met(so section 5 target would be maybe 10 and the function on frame one would keep adding itself by +1 and triggering a nextframe until 10 is reached) and vice versa for the "rewinding" part.
maybe something like myButton.onRelease = function() {currentframe+1}
If(var==1) {playnext frame(); or var =
var +1
Any help would be great, I've been searching the forums for a couple hours now.
Help: Drag Movement Restrictions And Mc Timeline Control
Hey guys.
I was wondering cause i have a movie clip called leftleaver_mc and ive made it dragable with the following codes.
this.leftswitch_mc.onPress = function() {
leftswitch_mc.startDrag()
}
this.leftswitch_mc.onRelease = function() {
leftswitch_mc.stopDrag()
}
that code obviously works but i what i want to do is make it so they can only drag up and down between the y coordinates of 990.1 and 793.8 on the stage and also not beable to move from the x coordinates of 276.4 while there dragging up and down.
================================================== ====
also another thing is when there moving the the leftswitch_mc up and down between them coordinates i want it to control an animation ive made in another mc called testcylinder_mc like the frame lable i want it to control in the cylinder mc is around 30 frames long starting at frame 6 of the mc's timeline and if they movie the leftswitch_mc up i want it to play that frame forward at normal speed and if they move leftswitch_mc down i want it to play that frame in reverse at normal speed and also if leftswitch_mc is at its original starting point i want the cylinder mc to return to frame 1.
thanks for reading i hope ive exsplained it easy for u guys to understand and to beable to help.
thanks in advanced
How Do You Control The Movement Of The Frames? Forward/Backwards
Hello all, I've been trying to figure out how to do an scrolling easing menu but instead of using xMove I have a continuous scrolling animation(from left to right) composed of keyframes instead. Does anyone have an idea of how I would script this? I'm totally lost, I'm trying not to use a goto trace function to keep the animation from being jerky. I'm not really sure where to begin with this.
1. determine whether the target that is chosen makes the frames go forward or backwords.
target = 1;
dir = "f";
incremental = function() {
if (target < current) {
dir = "f";
} else if (target==current) {
bar:dir = "null";
}
goto = (String(bar:direction+bar:current));
trace(goto);
}
2. Um I'm not really sure what after lol. I was thinking of making(althought i wouldn't know how=) a function that plays +1 frame until the target object variable is met(so section 5 target would be maybe 10 and the function on frame one would keep adding itself by +1 and triggering a nextframe until 10 is reached) and vice versa for the "rewinding" part.
maybe something like myButton.onRelease = function() {currentframe+1}
If(var==1) {playnext frame(); or var =
var +1
Any help would be great, I've been searching the forums for a couple hours now.
Control Movie Forward/backward With Mouse Movement
I've got a movie clip that I would like to control with the mouse. Wherever the mouse goes the movie will either go forwards or backwards depending on where the mouse is in relation to the center of the screen.
Also, I have 9 buttons across the top of this. How can I control the movie that when I click each button the movie continues to play up to a specified label. Then if I click another button it will move on to that specified label. All can get it to do is gotoandstop label"first". That just jumps it to the label. I want the movie to play through until it gets to the label and stop. Also, is there any way to make the movie run backwards? Like if I clicked frame label 9, then clicked frame level four that it would play backwards from 9 to 4. Know what I mean?
Question About Setting Buttons To Control Character Movement. Here's My Script.
Hey everyone,
okay, so I'm working on this game that's due tommorow.
My character is able to walk left and right with the script and the background starts to scroll behind it. That's all fine.
I am trying to add another key to make the character jump. I have the character animated jumping in a movie clip but it doesn't jump for some reason.
Here's my script:
code: if (Key.isDown(Key.LEFT) && x<125) {
_root.bg.prevFrame()
_root.guy.gotoAndStop(4)
facing="left"
} else if (Key.isDown(Key.LEFT) && x>=125) {
x=x-10
_root.guy.gotoAndStop(4)
facing="left"
} else if (Key.isDown(Key.RIGHT) && x>400) {
_root.bg.nextFrame()
_root.guy.gotoAndStop(3)
facing="right"
} else if (Key.isDown(Key.RIGHT) && x<=400) {
x=x+10
_root.guy.gotoAndStop(3)
facing="right"
} else if (facing=="right") {
_root.guy.gotoAndStop(1)
} else if (facing=="left") {
_root.guy.gotoAndStop(2)
}
setProperty (_root.guy, _x, x)
}
How do I add another key like the SPACE BAR and activate my jumping animation which is located at _root.guy.gotoAndStop(5)?
I tried just putting
code: if (Key.isDown(Key.SPACE)){
_root.guy.gotoAndStop(5)
but it didn't work.
Does anyone know how to write the next part so that the space bar will work? I don't really understand that much actionscript because I was using my teacher's scrolling background file to help me.
I'm going nuts
Thanks alot if you can help!
Changing Instaint Turn To Gradual Turn
I have this code that makes object one turn and face another object. They both move. How could I change this code so instead of the object instantly facing the other object, it gradually turns to face it?
k = Math.atan2(_root.man._x-this._x, this._y-_root.man._y);
g = k*180/Math.PI;
this._rotation = g;
Page Turn Effect / Turn Off
Is anyone familiar with the page turn effect here: http://www.iparigrafika.hu/pageflip/?
If so, do you know how I can turn off the effect? What I want is to be able to go directly to page 14, for example, without having to wait for all the pages to turn to get there. Thanks for any help.
My goal is to offer the "turn off" option for users with slow processors.
http://www.iparigrafika.hu/pageflip/
Timing. Turn By Turn.
Question:
if you have played the game FINAL FANTASY (any of them) you'll have a better understanding of what i am talking about. there is a think called ACTIVE TIME BATTLE (ATB) this is timing for u and your enemy.
when it is your turn to attack, the enemy's "clock stops" so u can decide what attack you want to use. then once you have cosen it, your character will attack, and then the enemy will attack before its your next turn again. then the process is continued until 1 character faints.
my question is i need to learn how to make the enemy only attack once after my character attacks, basicaly i need to know how to make the 2 (or however many characters there may be)
(no more then 6 in 1 battle)
good guy, enemy, good guy, enemy
basically like taht. if any1 has any tips or scripting they'd likde to help me with it would be highly appreciated.
thankyou.
P.S. if more explanation is needed of the topic just reply and i'll try to clear it up.
Turn Off And Turn On Again Set Interval
Hi all...
I have a problem with setinterval :
I have 4 frame , 1st frame :
stop();
setInterval(slideshow,3000);
function slideshow(){
nextFrame();
}
At frame 3 I have a mc , in that mc I have a button. If I click
it mc move right. So I want when I click the button in the same time I turn off setinterval (time line stop at frame 3) , then when I click the button in the second time (mc at right) I reactivate setinterval. Here is I attach the file......
many thanks
Mouse-movement Triggers Background Movement - Help Me Find Tutorial
I want to learn how to make an image react on my mouse-movement, so you get the effect as if you're looking around. You move the mouse to the right, and the image on the screen moves to the right, etc. I've seen an example of that on http://www.center-of-the-world.com/ - but I don't know how to find a tutorial for that on the Flashkit-site. Can anyone help?
Capturing Mouse Movement/locking Out A Direction Of Movement
does anyone have a good solution in AS 2 for simulating horizontal and vertical finger gestures like on an iPhone?
I have a Mouse listener that calculates movement in both directions and whichever one is larger in value (primary movement of mouse) then it locks out the other using a boolean value. And then once the mouseUp event is triggered, it sets the values to true again to listen for another horizontal or vertical gesture movement.
the problem I'm running into is that every once in awhile while I'm "gesturing" or moving the mouse in a particular direction, I'll get some funky results which clues me into that the other direction might not being totally locked out.
Make any sense?
Flowing Mc Movement Opposite Of Mouse Movement
I have a mc (fStrip) which looks like a piece of filmstrip with thumbnail images in it. I want this mc to move when the users mouse is positioned over it, but I only want it to move only along it's x-axis and in a direction opposite that of the mouse. And I want it to move or flow smoothly.
I've been trying to figure this out (see my lame attempt below) but without much luck. Can anyone help me out? Thanks.
onClipEvent (mouseMove) {
buffer=20 //movement buffer
mousePos=_root.fStrip._xmouse //store mouse position
if (mymouse!=_root.fStrip._xmouse){ //if the mouse has moved
diff=mymouse-_root.fStrip._xmouse; //find amount of movement
_root.fStrip._x-=diff/buffer; //buffer & set strips movement
updateAfterEvent(); //adding this makes the movement cleaner
}
}
Image Movement Based On Mouse Movement
I have my Flash canvas. In the Canvas I have an image that's centered and larger than the canvas. Obviously the entire image isn't shown. How can I use actionscript to move the image according to where the mouse is? So if I move my mouse to the top right corner I want the image to move accordingly to display the top-right corner (obviously in a smooth fashion . I tried looking for examples but wanted to know if anybody out there new.
Any ideas?
Little help and thanks in advance!
Brian
Ants Movement (based On Snow Movement)
Hey! I have a question for those who think they can help and might have the time to do so. I wish to get the effect of ants scuttering across the screen or up a tree, I have not decided which direction yet. I started with the tutorial code for the snow effect from kirupa, and changed it around to fit the little vector ant I created. The way I have it now looks pretty good, but the movement is a little too fluid. They obviously move in sinusoidal paths bc the code tells them to. I have about 20 copies of the main obj, and they're all a little different in size and specs (speed, transparency, etc) but what I was wondering was if there is any way I can change the code to make it a little more hectic, or erratic, not so fluid. If there is no way of doing so, it looks pretty good right now. If there is, however, I think it could look awesome. here's the code I'm using for the object.
onClipEvent (load) {
//stage
movieWidth = 850;
movieHeight = 50;
//mods for ants
i = 1+Math.random()*5;
k = 1.2*(-Math.PI)+Math.random()*Math.PI;
//each ant diff
this._xscale = this._yscale=38+Math.random()*30;
this._alpha = 75+Math.random()*100;
this._y = -10+Math.random()*movieHeight;
this._x = -10+Math.random()*movieWidth;
}
onClipEvent (enterFrame) {
rad += (k/70)*Math.PI;
this._y -= Math.cos(rad);
this._x += i;
if (this._x>=movieWidth) {
this._x = -3;
}
if ((this._y>=movieHeight) || (this._y<=0)) {
this._y = -2+Math.random()*movieHeight;
this._x = -3;
}
}
(I apologize for posting the code without one of those code boxes ppl use, I do not know how to do that yet....)
Any help is greatly appreciated! I wanted to congratulate everyone here at kirupa for having a great community, and great help to those that need it. I am so glad to be a part of it.
Luke
Object Movement Based On Mouse Movement
Not sure how to word this but. I have a object on the stage lets say that is 300 pixels wide. The actual stage is only 100px wide. I want to be able to "pan" the object left and right based on mouse position/movement. I saw a tutorial for it a while back but cant seem to find it. Anyone have a link to a tut or can throw out a little source code? It would be greatly appreciated.
Ants Movement (based On Snow Movement)
Hey! I have a question for those who think they can help and might have the time to do so. I wish to get the effect of ants scuttering across the screen or up a tree, I have not decided which direction yet. I started with the tutorial code for the snow effect from kirupa, and changed it around to fit the little vector ant I created. The way I have it now looks pretty good, but the movement is a little too fluid. They obviously move in sinusoidal paths bc the code tells them to. I have about 20 copies of the main obj, and they're all a little different in size and specs (speed, transparency, etc) but what I was wondering was if there is any way I can change the code to make it a little more hectic, or erratic, not so fluid. If there is no way of doing so, it looks pretty good right now. If there is, however, I think it could look awesome. here's the code I'm using for the object.
onClipEvent (load) {
//stage
movieWidth = 850;
movieHeight = 50;
//mods for ants
i = 1+Math.random()*5;
k = 1.2*(-Math.PI)+Math.random()*Math.PI;
//each ant diff
this._xscale = this._yscale=38+Math.random()*30;
this._alpha = 75+Math.random()*100;
this._y = -10+Math.random()*movieHeight;
this._x = -10+Math.random()*movieWidth;
}
onClipEvent (enterFrame) {
rad += (k/70)*Math.PI;
this._y -= Math.cos(rad);
this._x += i;
if (this._x>=movieWidth) {
this._x = -3;
}
if ((this._y>=movieHeight) || (this._y<=0)) {
this._y = -2+Math.random()*movieHeight;
this._x = -3;
}
}
(I apologize for posting the code without one of those code boxes ppl use, I do not know how to do that yet....)
Any help is greatly appreciated! I wanted to congratulate everyone here at kirupa for having a great community, and great help to those that need it. I am so glad to be a part of it.
Luke
Sluggish Movement With ActionScripted Movement...
I really enjoy using the following bit of code for quick little flash animations:
=======================================
onClipEvent (load) {
_root.targXscale = 50;
_root.targYscale = 200;
}
onClipEvent (enterFrame) {
cXscale = this._xscale;
cYscale = this._yscale;
difXscale = cXscale-_root.targXscale;
difYscale = cYscale-_root.targYscale;
setProperty(this, _xscale, cXscale-(difXscale/5));
setProperty(this, _yscale, cYscale-(difYscale/5));
}
=======================================
It comes straight from the tutorials ("Basic Animation via ActionScript"). Anyways, whenever I view the .swf (via IE) on my computer (2.4 Ghz / 512 MB RAM), it looks great... better than great... it looks AWESOME! But, if I check it out at work (550 Mhz, 256 MB RAM) it looks terrible. It's choppy, mouse movement is sluggish, and the entire animation looks like it's running at 1 or 2 FPS.
I know it can't be completely dependent on the computer speed, b/c I've seen other flash sites that look great on the slower PC. Even some of the non-scripted movements are sluggish on my work PC... what the?! Is there a snippet of code that would / could help?
"Electron Movement" Tricky Actionscript Movement Animation
Can anybody help me with the actionscript for this one?
Objects floating from right to left on a page, when they float into static objects instead of passing behind them or in front of them or bouncing off them and going the other way, they simply move round the static objects and carry on.
Like drunks walking through a jungle of lamposts.
Sound Control With Pause Button As Well As Timeline Control
Hi there
I have a flash page, with a ambient track playing. I added a pause and play button. So you press the button then it stops, then you press it again then it plays...
So now i want to make it so that if you go to the 'WORK' page on the site, wich is on its own frame, and wich has different buttons linking to it, then i want the sound to switch off when i am on the work page as well.
So if the background ambient music plays, and you go to work then the sound switches off. Untill you switch it back on again
How is the best way for me to do that?
How Do I Turn A Mc's Name Into A Var?
I hope I can explain this properly...
I basically need the mc to look at its own name and then assign this to a variable..
for example:
onClipEvent (enterFrame) {
if(_root.a1move){
difx = int(targetx)-this._x;
targetx = _root.a1;
speedx = difx*_root.friction;
_x = Math.floor(_x+speedx);}}
the mc's name is a1. so where a1 appears i want a more generic 'this_mc' type thing, so the clip is easier to reuse..
thanks,
m
[Edited by monkii on 02-07-2002 at 07:26 PM]
Turn That Up
Is there a way that Flash 4 can be used to directly control the volume aspects of a sound card rather than just the volume of a sound embedded within a flash movie ?
Cheers
Musicmaker !
Turn Around
I am looking for some help to turn around an object, example antique vase, take pictures of it from different angles and then present it as if it is being turned. I saw a programme that did this once, but I have no idea where it was, sort of IPIX but turning the object rather than turning the camera.
Any ideas, i am sure you have seen it somewhere.
How Do I Turn This Off?
Somehow I have enabled something that allows me to select and translate objectsclips while in between keyframes. Doing so sets a new keyframe in the middle of the others.
I'm working with a lot of clips and layers so this is really irritating.
Does anyone know what this is and how to turn it off?
Thanks
Turn Off A Key
How can I turn off a key?
I wan t to turn off the Enter Key
to avoid the pause/play issue if someone press on Enter.
Thanx
Help: Turn All Off But Turn One On.
Can someone please help me....I have 8 buttons. I need to turn one on, and turn the rest of them off. I can't figure out how to do this. do i use loops, booleans?
Which Turn To Take?
Hi,
Just a little direction if you please.
I am designing a flash front end that will call external applications throughout the movie. What I'd like to do is have flash pause whilst the application runs, and then when complete flash carries on playing.
It will be a utility to clean a machine of temp files, cookies etc. and then run rootkit scans.
I have created batch files and vbscript to run the applications....
...but, my reason for the war and peace literate is - who can recommend either a good book, site or at least some direction on where I should look to have this all automated within flash, have flash run the applications then pause until the application is complete and continue on.
Any tips are appreciated.
Turn Music On?
Hi all,
I know how to press a button an dturn all the music playing off....but now i want to create a button that turn the music back on. Please help me out and guide me on how to do that.
Thanx in advance
Atif
How Do You Turn Of Tabbing?
Hello,
I am trying to turn off the tabbing feature in flash. I understand that _focusrect turns of the tab highlighting feature but I want tabbing off altogether. How is this done?
|