Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Moving A Movie Clip While It's Playing



Is there a way to move a movie clip in code and still allow it to play?

The reason I ask is because I have a character that moves in the movie clip but whenever I use the keyboard keys to move the movie clip on _root, it stops his animation.

Suggestions?



FlashKit > Flash Help > Flash ActionScript
Posted on: 05-06-2005, 12:11 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Check If Movie Clip Finish Playing Before Playing Next
I'm trying to figure out how to create a conditional variable script to check to see if one of the 4 movies are finished before starting the next selected one.

I have 4 menus with 4 movie clips that have an opening and closing animation in them.
When clicking the one of the buttons I would like it to check and see if any of the movie clips are in the open position. Then have the movie that is in the open position play it's closing animation. Then play the selected category movie that the person clicked on.

I know it's all done with variables but just cant figure out how to put it together.

here is what i have so far.

menuStatus = 0;
trace(menuStatus);
but1.onPress = function() {
if (menuStatus == 0) {
menuwork.gotoAndPlay("start");
menuStatus = 1;
} else if (menuStatus == 2) {
resetMenus();

}
};
but2.onRelease = function() {
if (menuStatus == 0) {
menuwhoweare.gotoAndPlay("start");
menuStatus = 2;
}else if (menuStatus == 1){
resetMenus();
}
};
function resetMenus() {
if (menuStatus == 1) {
menuwork.gotoAndPlay("close");
menuStatus = 0;
} else if (menuStatus == 2) {
menuwhoweare.gotoAndPlay("close");
menuStatus = 0;
}
}

thanks for any help in advance

Problem With Movie Clip Moving When The Mouse Passes Over A Button On The Clip
The swf in question calls up a series of ads. To change the ads the user clicks on the forward and back button. However, when you mouseover the forward and back buttons the controlBar goes a bit haywire (as a result of the mouseOut on it).

All the files are attached in a zip file. Thanks in advance for your help guys.

Change Direction Of Movie Clip/stopping Moving Clip
Hello everyone,
I cannot wrap my brain around this anymore. It's been sometime since I have done much actionscript but here it is:

Functionality:
I have the movie clip moving from left to right and once it reaches a certain point, it changes direction and goes back, infinitely.

I have a hitTest to check weather the mouse is over the target movie clip, if it is, the movement stops.


Problem1 - Movement:
When I mouseover the target movie clip it stops (hitTest=true) but the movement does not resume when the hitTest is false.


Here's the code:
var xchange=10;
holder_mc.onEnterFrame = function() {
//trace("x_pos: "+this._x)
//trace("xchange: "+xchange)
this._x += xchange;
if (this.hitTest(_xmouse, _ymouse, true)) {
xchange=0;
this._x += xchange;
}
else{
if(this._x > 0){
xchange=10;
xchange*= -1;
}
else if(this._x < -645){
xchange *= -1;
}
}
}//--------------------------------------
Problem 2 - CPU Resources
Also I have code on the individual movie clips within the target movie clip, they simply play frames forward and backward to enlarge a thumbnail. After a while the computer starts hating life and chugs. I know it is from the hitTest checking on each enterFrame and it eats up the resources. Is there a way to do this without the chug?

Here is the code that expands the thumbnails within the target movie clip:

stop();
this.onEnterFrame = function() {
if (rewind == true) {
prevFrame();
}
};
this.onRollOver = function() {
this.swapDepths(this.getNextHighestDepth());
rewind = false;
play();
};
this.onRollOut = function() {
rewind = true;
};

//----------------------

If someone could give me any insight into this problem I would greatly appreciate it.
Thanks guys,
I hope I've been clear.

Moving A Movie Clip From A Parent Movie Clip
Fellas..


I've played with Flash 5 and action script a few years back.. just getting back into it recently. This might be a noob question, but I'm having a hard time trying to search for a solution.



I'm putting together a silly little game (Flash 8) that involves a tank, or missile base (ala Space Invaders) with a rotating turret. The tank consists of 2 movie clips.. one for the base/treads which attaches the mBarrel movie clip to itself.

This is a hard one to describe, so please bear with me.

I've managed to have the turret 'look-at' the mouse cursor, so it's angle adjusts to aim at where the player has the mouse reticle.

I'm firing a missile, by using some thing this..


Code:
function FireRocket():Void {

// firing a missile with attachMovie
_level0.mPlayer1.mBarrel.attachMovie("mMissile_Normal",
"mMissile_Normal" + _global.nRocket,
_level0.mPlayer1.mBarrel.getNextHighestDepth(),
{_x:(_root.mPlayer1.mBarrel._x), _y:(_root.mPlayer1.mBarrel._y)});

}


My missile has a script that simply += it's _y.




THis works beautifully. A missile appears *right* inside mBarrel, and adopts it rotation, and by having the missile MC increase/decrease it's _y will send it in motion. I was originally planning on having to use matrices to have the fired missiles inherit the barrel's angle, but having the barrel movie clip call the missile movie clip worked amazingly well.

The thing is.. if I rotate the barrel (by moving the mouse cursor) ALL the rockets automatically change their angle along with the barrel.. as to be guided missiles per se.

How do I stop the missiles from moving along with their parent MC?


wheeew..

Playing Movie Clip From Inside Movie Clip
Hi all
I have a button which you click on and it makes a window slide onto the stage. Inside this movie clip I have another button. When I click on this button I want another mc to slide onto stage. Everything works fine except for the button inside the first mc. Any suggestions? Here is the script I have on the button that doesn't work
on(release)
photoslider.gotoAndPlay(2)
I've also tried (with no luck)
on(release)
_root.photoslider.gotoAndPlay(2)
and _parent.photoslider.gotoAndPlay(2)

Hope you guys can help me out!

Thanks

Playing A Movie Clip Inside A Movie Clip
is there a command i can use to activate another movie clip from within a movie clip?

thanks

Moving A Movie Clip?
Hello

I can not seem to figure out or find the answer to this.

I have a movie clip called 'ball'.

Ball starts out at x/y of 100,100.

I want to move ball to say 187,372 but fluidly not just disappear at one x/y and reappear at the destination x/y.

Anyone know how to do this?

Thanks

Moving A Movie Clip
This is really, really newbish..

Anyways, how does one "move" a movie clip? For example, I press the up key and the object moves a bit up?

Moving Around In A Movie Clip
I'm trying to jump to frame 100 of a movie clip (weltext) when i release a button. I can't get it to work.

on (release) {
_weltext.gotoandplay(100);
}

Moving My Movie Clip
im really stuck on some work at the moment and any help will be GREATLY appreciated.
right i have a long movie clip (in length ways not animation,its all in one frame) and i have a number of buttons and what i want to happen is that when i select one of the buttons the movie clip scrolls horizontally into a certain position.
so for instance the registration point of my movie clip is at axis x=100 where picture 1 is and then when i select button 10 (for picture 10, which is off screen) i want my movie clip to scroll so that the picture is onto axis x=100.

any help will be greatly appreciated
thanks

Moving A Movie Clip.
I am making a new movie with a menu system. All the content is in a movie clip. When a button on the menu is pressed then i need the movie clip to move smoothly to a certain position so that the content that is needed is visiable. I would usualy use motion tweens but its complecated when there is a menu because you would have to make a tween for every content bit to go to every other :S

Please could someone help me with the actionscript that is needed. Thanks alot!

-JAM

Moving A Movie Clip.
Hi people.

I can move a MC via actionscript which is loaded into a empty MC called Clip.I use a var called xpos to move the MC across the stage.
i call the MC via a button eg. When you click onto the button the page is loaded into the empty MC called Clip, then the MC scrolls from left to right and stops in the centre of the stage.
Promblem is when i click onto another button i want the
MC to scroll from the centre of the stage to the right then load a new page into the empty clip as before.
The buttons are on the main time line( _root).

How after the MC has moved from the left and then i call another page from a button, how do i get the MC to move to the right.

Cheers Dave....

Moving A Movie Clip Around
I am making a game where players can pick up objects and use those objects to unlock doors, chests, closets, etc. I need to know what would be the best and easiest way to do this. How can I make it to where the player can click an object on the ground, send it to the top of the screen as if it were in their "inventory", and then later use it to unlock a door. I've asked this question for the last 3 days and no one can seem to help me.

Moving A Movie Clip?
got a wide movie clip on the stage and on the press of a button i want it to go to certain X position on the screen, but i want it to move so many pixels per second, so it gives it a scrolling effect!

Currently im doing it on the timline but am encouting a few problems when coming to play it, so would like help on coding it using action script!

Thanks in advance!

Moving In A Movie Clip
Hi there!
Hope u all had a nice holidays!

I have a button in my movie clip. This same button is located down in my movie clip. Once this button is pressed, you reach another frame from the same movie clip but at the same hight of the button.
How could i direct the user to the top of the frame after pressing the button? And not keep the same "hight" of the button.

Cheers.
Leo.

Help With Moving A Movie Clip
I have three movie clips (home,menukaart,catering) when on (rollOver) of menukaart i would like to have catering move 75 pixels down, in order to have a sub menu appear from menukaart. And on release move back up agean.

I don’t have experience with scripting, I have tried all move function examples that i could find bat with no results. Could some one help me?

p.s. There are some other bugs that, you’ll see what I mean when you play the file.

Thanks in advance for all

Moving A Movie Clip
Hi folks,

I'm new to Flash and Actionscript and I'm trying to move a movie clip with the directional arrows, using AS 3.0.

The old code I had:

Code:
var speed = 7;

this.onEnterFrame = function() {
if (Key.isDown(Key.UP)) {
square._y -= speed;
}
if (Key.isDown(Key.DOWN)) {
square._y += speed;
}
if (Key.isDown(Key.LEFT)) {
square._x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
square._x += speed;
}
};


The code is broken for AS 3.0 and I don't how to fix it.


Thanks in advance.

Moving Movie Clip
Hi all,

I have a movie with buttons in it that move a movie clip up and down. How do I make it stop moving up or down once it has reached the top or bottom?

Thank you,
Mike W.

Moving A Movie Clip
If I wanted a user to be able to move a movie clip around...what sort of code would I need to add to the movie's MOUSE_DOWN event listener?

Moving A Movie Clip With AS3
Hi, I am making a game with ActionScript 3.0 but I am having problems with moving the main character. All I am doing is having the main character be stationary and having the ground move below him (A topview game). I made the same thing in AS2 but I need to convert it to 3.0.
Heres a link to the game, http://randomflashgames.net/gamepages/stick.html

What I have now in AS3 is a listener that listens for a key down but it only works for one key at a time. I need it to be able to listen for 2 keys at a time to go diagonal. AS2 has this (To the best of my knowledge)


ActionScript Code:
If (KeyPress.KeyDown(Key.Left) == true){
   //Move the background giving the illusion of movement
}

Is there anything equivelent to KeyPress.KeyDown(Key.Left) in AS3?

Moving Movie Clip
Hi! Im having some troubles on a movie clip. Instead of making this movie clip frame by frame, I want it to keep moving, even when the moving is not playing, how do I do this?

Thanks

-Yut343

Moving A Movie Clip
Hi everyone,

I have a daft question which probably has an extremely simple answer but I am still a newcomer to flash. I wanted to do a trick where I have a movie clip and the user is able to drag the movie clip around the stage while holding down the mouse key. Any ideas? I have an idea but wanted to see what others thought?

Thank you

George

Moving Movie Clip
ok it's simple as hell but I can't seem to do it.
I have a movie clip I want to move back and forth between 200 pixels and 600... this is the code i scripted fomr scratch and it doens't seem to be working for me, it gets to 600 then drops below 600 and doens't slide back to 200. What can I do?

onClipEvent(enterFrame) {
speed = 3.5;

if (this._x>600){
this._x -= speed;
}
else {
this._x += speed;
}
}

Moving Movie Clip
Hi! Im having some troubles on a movie clip. Instead of making this movie clip frame by frame, I want it to keep moving, even when the moving is not playing, how do I do this?

Thanks

-Yut343

Playing Movie With A Button Inside A Movie Clip
OK LETS START FROM THE VERY BEGINING HERE...

I HAVE A BUTTON THAT IS IN A MOVIE CLIP, WHEN I TELL IT TO GOTO AND PLAY THE FIRST SCENE FRAME 2, IT PLAYS THE ANIMATION IN THE MOVIE CLIP AND NOT THE SCENE. WHAT SCRIPT DO I USE TO TELL THE BUTTON TO PLAY THE MOTION TWEEN IN THE FIRST SCENE ON THE SECOND FRAME.

Playing A Movie Clip In A Different Frame Rate That The Movie Has HELP
Hello all, im trying to play a mc in a different frame rate than the movie (im using flash 5) is it possible?? any help appreciated !!!
Thanx in advanced.

Playing Ext. Movie Syncronized With Internal Movie Clip
HI there,

I want to loadMovie and I want to stop it till it loads all together; so I need preloader. Then there is another movie clip for 20 frames lets say, which is in loop, and I want this small one start with the external one (it will loop about ten times while other plays) and finish when it finishes. My preloader is not working. I made an interval and made an evaluation of getbytesloaded/...total, but movie starts anyway and it is very slow because it is also loading at the same time. I will be glad if you have any suggestions.

Thx.

Playing A Movie Clip...
how do i make my movie clip play? i'm doing my personal flash site. what i wanna happen is: "whenever a menu button is pressed, an item(movie clip) should play". to get my idea, pls open this site...http://arsendomain.tripod.com
get it!? pls help meeehhh!!!

thank you!

Playing A Movie Clip...
how do i make my movie clip play? i'm doing my personal flash site. what i wanna happen is: "whenever a menu button is pressed, an item(movie clip) should play". to get my idea, pls open this site...http://arsendomain.tripod.com
get it!? pls help meeehhh!!!

thank you!

Movie Clip Not Playing
Ok, here goes:

In my scene, all located in ONE frame. This frame has a STOP action, so this all takes place in one frame.

I have 3 movie clips.

One is in top right corner, is a news ticker that just loops constantly.

One is in left, and is just a scroller of images when down/up arrow is moused over.

Both those two are working fine.

Third is a ladder type list of 4 text images. Now, right click on that one to edit it, and each text image is a button. The object action of the first one is to this.gotoAndPlay(2). Frame 1 and Frame 15(of this movie clip) have STOP actions. 2-14 play the first text image moving in a straight line up, and stopping there.

Now, when I publish, and test it out, when I click on the first text image, the image jumps up to it's ending spot then right back to it's original, all in about half a second so you can barely see it. Almost as if it's playing superfast than stopping back at frame 1 of the movie clip.

Any help would be appreciated, or if you need more info please let me know. Thanks.

Playing A Movie Clip
I am new on the flash stuff.. I and I am doing my first work on it.. I was trying to put an action script in a button.. But it doesn't work. Let me explain this:

I have in the main timeline a movie clip named "empresa" this movie is a track menu, inside this movie clip I have button where this button will call other movie clip named "informacion" it is find in the scene 2, but I put the next code:

on (release) {
gotoAndPlay ("Scene 2", 1);
tellTarget ("../informacion") {
gotoAndPlay ("Scene 2", "somos");
}
}

and it doesn't work .. Can you help me ??

Movie Clip Keeps Playing
Hey everyone I have a complex animation which has 2 scene's and alot of loadmovies. On my first scene I want the movie to play once then go to the next scene and play all it wants to do is play the first scene over and over.
Help
Alpajack

Movie Clip Not Playing.
Hello, I'm rather a newb at flash, but am trying to get going. I have made a simple menu clip, but when i move it into my scene and scale it, it doesnt seem to play...any help will be appreciated, I have attached the FLA for you to see.

Playing Other Movie Clip...
Right...I have a movie clip with a button in, and I'm trying to make the button be able to play another movie clip with the on press feature.
Please help!!!!
Thanks in advance!

Movie Clip Not Playing...
Am trying to play a movie clip that does not seem to be co-operating.
It shoulf run when the else statement plays, in this case if any box is checked other than "AnswerQ1".

It seems to run if I put it in the If statement, but not in the "else" hope someone can help...!



Script:


stop();

function correctq1(quest1){
AnswerQ1 = quest1.getLabel();
//trace(AnswerQ1);
if(AnswerQ1=="The Retail Delivery Report") varQ1a =true;
rightAnswerQ1 = true;


};


function yourAnswer(component) {
if (rightAnswerQ1) {
rightAnswers=rightAnswers+1;
//trace("rightAnswers - "+rightAnswers);k

}

else {
rightAnswerQ1 = false;
init1 = {_x:260,_y:280};
_root.attachMovie("ans1", "ans1",20,init1);
//trace("wrongAnswers - "+wrongAnswers);
}
yourGrade=Math.round(100*(rightAnswers/(rightAnswers+wrongAnswers)));
//trace(yourGrade);
gotoAndPlay(nextFrame());
}

//this function is called when the tryagain button is pushed
function tryAgain() {
//frame 1 initializes the tally of right and wrong answers to zero
gotoAndPlay(1);
}

Movie Clip Not Playing....
Hello,

Thank you for taking the time to read this subject.

I'm trying to have a movie clip play, but for some reason it's not playing. I have the main timeline, and I place on frame No. 6 the movie clip I want to play and I have another layer with the text I wanted to display, but when I preview the movie it't not showing up, the only thing I see is the Text. I would really appreciate all the help you can provide.

Thanks in advance for any response,

Playing Movie Clip
Hi,

I've got a movie clip of a bird flapping it's wings. I then put this mc down on the main stage and aligned it to a path so it moves. But the bird is not flapping it's wings it's just on the first frame of the bird animation. I figure I'm just missing something obvious, I just don' know what!!

I'm using MX2004 if it makes any difference.

Thanks

Alex

Playing One Movie Clip After Another
So I have 2 movie clips, one controls the _x position of a movie within the clip and the other movie clip controls the _xscale of a movie within it. When i put these two movie clips on the main timeline they both play at the same time, so both the animations run simultaneously, which is not what I want. I want one movie clip to play and then have the second play after the first is finished. However, both _x position and _xscale are controlled by actionscript and not tweens. Basically i'm using the inertia behavior to create real movement. Anyhow how do I set up one movie clip to play after the other one reaches it's position?

I want to do something like this link:

http://www.dennisleephoto.com/

Playing Movie Clip ..can Someone Help Plz
Hi,

I'm trying to have a movie clip appear from the top of the stage after every 10 seconds.

and I want it to appear from varying x locations of the stage.

here's my .fla [L=click for source ]http://www.sfu.ca/~hzaidi/spider.fla[/L]

Can someone tell me how to randomize the x location and make it appear after every 10 sec?
I tried this this._x = random(500); for random x, but its too fast and doesnt play the movieclip.

any pointers will be appreciated.
thnx.

[CS3] Playing A Movie Clip.
Extreme noob question here.

When playing a movie clip on release in action script 2.0, does the MC have to be on a layer in order for it to be played?

Can it just be played by calling it out of the library?

I'm having some issues with getting a MC to play on release and was just curious about that.

Thanks

Movie Clip Not Playing?
I'm still a flash noob (I've only been working with it for a few months) but I'm trying to put a game together and I'm still at the very beginning stages. Right now I'm still working on having my character move around the map corresponding to the keyboard arrows being pressed. The way I have it set up is the character on the main timeline is mc "Guy". Inside mc sprite are mc's guyup at frame 1, guyright at frame 2, guydown at frame 3, and guyleft at frame 4. Inside guyup, for instance, is a graphic of the character facing up at frame 1, frame 2-3 contain an instance of the character taking a step up with his right foot and frames 4-5 contain him taking a step forward with his left foot. The same concept for right, down, and left.

The script on the main timeline is;

PHP Code:



stop();
var up:Boolean = false;
var right:Boolean = false;
var down:Boolean = false;
var left:Boolean = false;
var mainSpeed:Number = 3;

stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown);
function checkKeysDown(event:KeyboardEvent):void {
    if (event.keyCode == Keyboard.UP) {
        up = true;
    }
    if (event.keyCode == Keyboard.RIGHT) {
        right = true;
    }
    if (event.keyCode == Keyboard.DOWN) {
        down = true;
    }
    if (event.keyCode == Keyboard.LEFT) {
        left = true;
    }
}

stage.addEventListener(KeyboardEvent.KEY_UP, checkKeysUp);
function checkKeysUp(event:KeyboardEvent):void {
    if (event.keyCode == Keyboard.UP) {
        up = false;
    }
    if (event.keyCode == Keyboard.RIGHT) {
        right = false;
    }
    if (event.keyCode == Keyboard.DOWN) {
        down = false;
    }
    if (event.keyCode == Keyboard.LEFT) {
        left = false;
    }
}

stage.addEventListener(Event.ENTER_FRAME, walk);
function walk(event:Event):void {
    if (up == true) {
        Guy.y-= mainSpeed;
        Guy.gotoAndStop(1);
        Guy.GuyUp.gotoAndStop(2);
    }
    if (up == false) {
        Guy.GuyUp.gotoAndStop(1);
    }
    if (right == true) {
        Guy.x+= mainSpeed;
        Guy.gotoAndStop(2);
        Guy.GuyRight.gotoAndPlay(2);
    }
    if (right == false) {
        Guy.GuyRight.gotoAndStop(1);
    }
    if (down == true) {
        Guy.y+= mainSpeed;
        Guy.gotoAndStop(3);
        Guy.GuyDown.gotoAndPlay(2);
        Guy.GuyUp.gotoAndPlay(1);
    }
    if (down == false) {
        Guy.GuyDown.gotoAndStop(1);
    }
    if (left == true) {
        Guy.x-= mainSpeed;
        Guy.gotoAndStop(4);
        Guy.GuyLeft.gotoAndPlay(2);
    }
    if (left == false) {
        Guy.GuyLeft.gotoAndStop(1);
    }
}




The only other code is inside the movieclips guyup, etc. On the last frame it says gotoAndPlay("2"); so as to continue the continuation of the walking.
My problem is that when I press an arrow key, the guy will move in the corresponding direction, but the movie clip wont play. Instead of going rightstep leftstep rightstep leftstep etc, he goes rightstep and stays like that while still sliding across the screen.

I've tried for a very long time to figure this one out on my own but I just cant. :/ If any of you have any ideas that'd be awesome. Thanks in advance!

Movie Clip Playing Or Not
This may be something simple, but i just don't know the properties I need to call on.

I have 2 buttons and a MovieClip on the main timeline. The buttons control the MC, forward or backward to stops (every 60 frames). I remove the event listeners, so the buttons can't be clicked between stops. I want to add them back only once the MC stops playing.
Is there a simple command I'm not aware of? Like an if statement.... if the movieclips is stopped, then add event listeners? The "playing" property seems to relate to FLV playback, not a MovieClip.

Movie Clip Is Not Playing
Heres my prob i got this movie clip and when it gets to it on the timeline it doesnt play no matter where i put the clip it won't play what gives?

Movie Clip Not Playing... [Help Pls]
Hello,

Thank you for taking the time to read this subject.

I'm trying to have a movie clip play, but for some reason it's not playing. I have the main timeline, and I place on frame No. 6 the movie clip I want to play and I have another layer with the text I wanted to display, but when I preview the movie it't not showing up, the only thing I see is the Text. I would really appreciate all the help you can provide.

Thanks in advance for any response,

Movie Clip Is Not Playing
Heres my prob i got this movie clip and when it gets to it on the timeline it doesnt play no matter where i put the clip it won't play what gives?

Movie Clip Keep Playing
I want that a mc play his animation when mouse rolls over it, then if mouse rolls over out, the mc must to be playing until certain frame, and if mouse is out play in the same mc another frame number

is it possible?



---LastCyborg---

Moving A Movie Clip Randomly
Hi all,
my stage size is 550x400 and movie clip is about 20x20 now
i want this clip movie randomly about 5 pxiles from its position how can i do this.
what i did so for is
setProperty ("one", _x, random (5));
when i played that time this clip gose left side og the stage and playing randomly 5, but i need this to play exactly where iam placed in main stage.

Thanks for replay :-)

Naushad.Bangalore

Moving A Movie Clip Using The Keyboard
Does anyone know how to make it so you move a movie clip up, down, right, and left by using the keyboard? Any help would be awesome.

Moving A Movie Clip With A Rollover...
ok, I have an invisible button that I want to activate a movie clip with. When a rollover occurs I want the movie clip to move to the position of the mouse pointer, but over time, not instantly. I have tried several ways but I am a novice scripter and i would appreciate any help you can give. Thanks!

-rYan

Copyright © 2005-08 www.BigResource.com, All rights reserved