Move Objects On A Semi-circular/elliptical Path
Hi guys,
I'm stumped ... I need to move a bunch of attached movieclips along a concave elliptical path to the left and right. It should stop when the extreme left and right movieclips hit the stage center point while moving left or right.
Really need your help ... in a jam ... or maybe a soup .. HELP !!!!!!!
- Oz
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-20-2007, 07:09 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Move Object Along DYNAMIC Elliptical Path
I'm working on a flash version of Grand Theft Auto. I got a level laid out that you can drive across and where you can encounter AI. The AI works in the sense that it is able to make decisions at intersections. I also get the AI to move at their own speed BUT with the displaying of turning at intersections arises a problem.
The ai needs to calculate its own path from start of the turn to the end, taking into account its starting direction and the direction to end at. I thought about solving this by simplifying the turn to a quarter-circle but then the code wouldn't work for intersection with roads at an arbitrary direction.
so the AI basically needs to calculate the path from A to B with the code supporting any direction of road A and B.
Perhaps an elliptical path could provide the solution but I haven't found a way to calculate the direction of such a path at any one position.
any ideas? thanks
A Movieclip Move Along Circular Path When Moving The Mouse
How do I get a movieclip move along circular path when the mouse is moving in AS3?
The MovieClip's instance name is object.
Here is how I did it in AS1.
Code:
stop ();
startDrag ("/drag", true);
/:width = 200;
/:height = 200;
/:ox = eval("/:width") / 2;
/:oy = eval("/:height") / 2;
/:radius = 52;
Regards,
Glen Charles Rowell
Semi-circular Image Gallery
Hello all,
It's been a while since I used Flash - so I'm rusty (and I using Flash 5)
Anyway, I am making a semi-circular image gallery where the thumbnails rotate around the main image in the center of the semi-circle. Kinda like "the Fan"
I need help loading the thumbs from a db or an xml file?
I have tried to find tut's or articles on this but they all address action script 2.0+ Does anyone know a good tutorial or have some quick tips to help me get started??
Can I use loadMovie if my thumbnail movie clips are nested inside a larger movieclip that handles the rotation of the thumbnails??
Thanks for any help
Drag An Object Along The Elliptical Path
Hi
I want to drag an object along elliptical path.
Example :
I am having Sun (Graphic) in the center of the stage, User need to drag the earth(Graphic) around the sun in the elliptical path.
Can any one suggest any way to archive this...
Thank you
Thanigaivel
Rotating Items In Along An Elliptical Path
Hey guys, I've been racking my brain on this, but I can't seem to figure it out.
I have a group of items that are positioned into an ellipse. I'm trying to get the items to rotate collectively to specific rotations. For example, I click one of the items in the ellipse which rotates all the items collectively until the clicked item is at the top of the ellipse.
Placing the elements to form an ellipse is easy, as is collectively rotating them. The problem is the further the ellipse is to being a circle, the rotations are off. I have been hitting the math sites like crazy, but I can't seem to crack this.
The function below is what I am using to attempt to rotate all items along the ellipical path so that the specified item is at the top of the ellipse
Code:
public function rotateCellToTop(cell:Cell):Number
{
var xR:Number = cell.link.x-(_x+_width/2);
var yR:Number = cell.link.y-(_y+_height/2);
var rads:Number = Math.atan2(yR, xR);
//rotation of individual object
var a:Number = rads*(180/Math.PI);
trace("item rotation", a);
return a;
}
This function is what I use to move each item in the elliptical path
Code:
private function adjustLayout():void
{
var len:int=this._cells.length;
var rOffset:Number = _rotation*(Math.PI/180);
var w:Number = this._width/2;
var h:Number = this._height/2;
var sb:Number = Math.sin(rOffset);
var cb:Number = Math.cos(rOffset);
var rad:Number;
var c:EllipseCell;
for(var i:int=0; i<len; i++)
{
c = this._cells[i];
rad = ((Math.PI*(i))/(len/2))+rOffset;
c.x = (w*Math.cos(rad))+(w+_x);
c.y = (h*Math.sin(rad))+(h+_y);
}
}
This has been absolutely killing me - any help at all would be beautiful. Thanks.
Using Trig To Make A Varying Elliptical Path ..
Posted this before, didn't get any replies .. Will try to be more clear as to what I'm asking this time ..
I'm wondering how to make a varying elliptical path for a movie clip to follow. Here's a crude drawing of what I want to do: http://asuaf.org/~fsjrn2/ellipse.gif
And here's the AS I've been using, but it is limited to a regular ellipse:
Code:
onClipEvent (load) {
cnt = random(10); // randomizes start position
speed = 10; // speed of rotation
height = 560; // height of movie
width = 990; // width of movie
centerX = width/2; // center X coord
centerY = height/2; // center Y coord
pi = Math.PI; // pi variable
}
onClipEvent (enterFrame) {
if (cnt<2*pi) {
_x = centerX-((width/2)*Math.sin(cnt));
_y = centerY-((height/2-40)*Math.cos(cnt));
cnt += speed/256;
}
else {
cnt = 0;
}
}
Anyone have any pointers or ideas?
--
CRC
ethereal@gci.net
ICQ: 15346923
--
3D Circular Scroll Menu Source Code In Semi Tutorial Format
I made this as an answer to a "how is this done" question.. it's basically like a rip off of the new intelMac's remote screen. with icons moving around in circles. I made 2 versions, a simple one with just mouse scrolling, and another with combined mouse scrolling and button control. (force rotate to a selected item)
So, this should be good for those looking to do circular menus. It was certianly a good learning experience for me to make it. It's also very bite size so it'll be good for beginners to just see how simple AS projects are supposed to be written.
well, I did leave stuff on the stage so the script wouldn't get cluttered with "attachMovie" lines.. but other than that, I think it's in pretty good form. Comments welcome.
Arrange Objects On Semi-circle
The well-known carousel tutorial brought me to the idea of arranging a number of objects on a semi-circle.
It works pretty well with this slighty-modified function:
Code:
var myobjectcount:uint = 9;
for (var i = 0; i < myobjectcount; i++)
{
var myobject:Myobject = new Myobject();
addChild (myobject);
var radius:Number = 150;
var centerX:Number = stage.stageWidth / 2;
var centerY:Number = stage.stageHeight / 2;
myobject.angle = i * ((Math.PI * 1) / (myobjectcount - 1));
myobject.x = Math.cos(myobject.angle) * radius + centerX;
myobject.y = Math.sin(myobject.angle) * radius + centerY;
}
Now i want to arrange the objects starting from the "north-pole" going to the "south-pole" of the semi circle. In other words, the whole circle has to be rotated 90 degrees to the left. As you can see, i'm not too much into mathematics, so any ideas?
Circular Path To X,Y Coordinates?
I need to duplicate a series of movies on a circular path. To do so requires Trig, which I don't know. Could somebody please point me to the right Math?
Thanks for your help,
-PiXELWiT
http://www.pixelwit.com
Circular Path For Text
I am trying to make a movie in which the text comes from the left side of the stage, goes to the center and then goes round in a quick circle and then comes to a stand still. How can I make the text follow a circular path. I drew a circle on the guide layer and then on the text layer I attached it to the cicle at the starting frame. After a few frames I inserted a keyframe(F6) and attached the text to the circle once again. However, this technique did not work. I would be grateful for any guidance.
Thanking in anticipation.
Stupid But - How To Animate Something Around Circular Path?
I've tried earlier, and had a fix for it, but now I'm stuck again: please, how do I move something around a closed path like f. i. a circle?
I've tried to search the tutorials, but all I could find was something for 3D Max...
Please help me out, I'm sure there's a simple solution to this.
Masking Circular Path Problem
Hi,
I've got an interactive component that looks like a radar so it's a circle and it's divided into 3 sectors like a pie chart where each sector slightly has darker and darker colour. So what I need to do is find a way to dynamically mask these sectors so that when I use controls - two sliders the mask moves and reveals new parts of the circle area untill it reaches 360 degrees or if I use other slider goes the other way around and hides area anticlockwise. I have all the graphics in place and I've done similar things with slider I have them working .. but for this case I don't know how to make mask do the circular motion so tha I can control it with sliders. so the mask has to do this motion somehow.. put your thumb and your forefinger on the desk now keep thumb central and don't move it and move your forefigner so it makes circular motion.That's the motion I need to do.... I can do it as a single line rotating but I need it as a mask like filled area ....Any ideas ???
Cheers
Text Scroller With Circular Path - HELP
HI GUYS -
go to:
http://www.26gordonstreet.com
click view view showeroom
then click menu (litte motion sensitive thing at the top)
then click features -
and youll be taken to an area with beatuful renderings and a text scroller with a semi circular path. how is this done? can anyone help?
I have a fair idea that the actual scrollbar is invisible, and moves vertically as normal, but that also triggers an animation which moves around a circular path. Then again maybe im COMPLETELY wrong!
Any help would be greatly appreciated guys.
Cheers
Rotating Text On A Circular Path - How To Do It?
Hello,
New Flash user here. I have a customer who is interested in a having a banner made that has a circular text on a path type effect in it. He has a round logo would like words/sentences rotating around the circumference. Each sentence will change to a new sentence after a short time, but I have not gotten that far.
Thanks in Advance!
R. Seider
Constrain Dragging To A Circular Path?
I am designing an interface where a person will drag a circular measurement tool (called a goniometer) over part of an image, and then rotate two different arms on the tool to measure an angle.
The entire tool itself needs to be draggable by its center. So far I have the arms rotating by means of pressing the arrow keys on the keyboard, but it would be more realistic to have the user drag the arms to rotate them. I can't think of how to accomplish that, though.
Please see this example to get an idea of what I am doing:
http://interactive.elon.edu/goniometer.html
My other question is, why is it that you have to click the mouse somewhere on the screen before the key arrows will work?
TIA!
Animating A Mask In A Circular Path
Hey there. this is more a animation based question.
I know that you cannot use motion guides on mask so i was wondering how i can create a animation to reveal a pen style highlight.. like when you circle a piece of paper to indicate something of importance.
what i have tried is the obviously frame by frame animation of cutting out the shape to reveal a section of it each new frame, but thats just time consuming and well you dont have speed control (easing as well).
I have tried using a graphic in a graphic animated by a motion guide and using that graphic as a mask and that sorta works but it dosent really help since you need to make that motion guide graphic reveal as well, so its actually double the work.
just wondering if any one has some method that would be helpful.
:oh i tried shape tweens and while im pretty good at them, they seem more trouble than help with a circular motion. shape hints helps but it again is too much work for such a simple graphic element.
Rotating A Textfield In A Circular Path
Hi,
I'm having a problem with a movieclip that contains an object (a circle) in the middle. Off to the side is a text field. I want to rotate the whole movie clip at pre-determined degree increments and have the text field follow along. Although it does rotate, it will not follow a concentric circular path about the center--it's path is skewed by something--perhaps a transformation point that I can't locate. Other objects within the same movie clip do rotate properly.
I've attached a sample fla that demonstrates the problem by clicking the button to rotate the clip 90 degrees with each click.
Here is the stage code:button_mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick (event:MouseEvent):void
{
circle_mc.rotation +=90;
var currentRotation:Number = circle_mc.rotation;
circle_mc.dt_txt.text = currentRotation;
circle_mc.dt_txt.rotation = -currentRotation;
trace("current rotation = " + currentRotation);
}
button_mc.buttonMode = true;
Thanks!
Constrain Dragging To A Circular Path?
I am designing an interface where a person will drag a circular measurement tool (called a goniometer) over part of an image, and then rotate two different arms on the tool to measure an angle.
The entire tool itself needs to be draggable by its center. So far I have the arms rotating by means of pressing the arrow keys on the keyboard, but it would be more realistic to have the user drag the arms to rotate them. I can't think of how to accomplish that, though.
Please see this example to get an idea of what I am doing:
http://interactive.elon.edu/goniometer.html
My other question is, why is it that you have to click the mouse somewhere on the screen before the key arrows will work?
TIA!
Any Tutorials On Spinning Distorted Bars Around Circular Path
hey just wondering if anyone has tutorials on making those little spining bars you see everywhere..
ex http://www.xeofreestyle.com/
next to loading.. than on the girls eye.. than n zoom out on the left of her head.
I imgagine this could probably be done by distorting a square, lowering the alpha and putting it on a motion path of a cicle line. Just wondering if there are any tutorials on it. Thanks
Circular Objects Bouncing
Im am trying to make flat circles bounce around on my webpage, i have put a square boundry around them so they stay on the screen already. But I also want them to bounce off eachother, any help would be much appreciated.
2 Part Q: Button Events, And Cursor/circular Path Scripting
Hi There, I am building a clock where the minute hand functions as the menu selector, i.e., 12 o'clock loads 'menuitem 1' to the left of the screen in a space reserved for it, 1 o'clock loads 'menuitem 2' there, etc--on Rollover. OnClick it should load a movie into the main frame.
Currently, I have 12 'pie shaped buttons with just the hit area defined, so that if someone is over 1 o'clock, it's affecting that button's hit area. So in theory, I've defined the mouseover and clicking areas, but I haven't any scripting yet, nor an arm.
First problem: I can't figure out how to attach any events to the buttons! They are 12 buttons (for 12 hours) each in a layer of a movie clip that has them, and the clock itself as the first layer. I want to go 'on Rollover goto and play (proper frame label in other movie clip)' and 'on click goto and play (proper movie clip) for each of the 12 hours/hit areas in the 12 buttons.
But I can't even get the actions to go from gray to black in the action panel?
Second problem: I need to build an arm that properly follows the mouse as it goes around the clock. I'm guessing I need to have a script that notes where the mouse is, and I need to have a script that includes a bunch of MATH stuff like PI and atan etc. I've no idea how to do that--to create a sequence where you can have the arm track properly around the circle of the clock when the mouse is over the face...?
Any help here would be much appreciated.
shawn
Collision Detection For Circular Objects
Hi all
a nice easy one to start the day!!!!
I have 2 spheres that i can pick up with the mouse and throw around the stage. Each one can be thrown inependantly of the other - you know.
I want to be able to detect a collision when one hits the other and so apply the relevant calculations to send them both off in different directions
Any idea on how to detect a collision at the circumference of the sphere and NOT the square edge of the movieClip object itself????????
Thanks in advance.
Collision Problem In Circular Objects
hey guys,
plz help me solving collision problem..ive to bounce 2 balls n ther shud b collision detection at th edges..i tried distance<summation of radii.but in that case the balls are intersecting... n ive to solve this using x and y co-ordinates only..no sine or cosine or tan functions..
[F8] _rotation Issues Calculating Orientation On A Circular Path, Scalextric/slot Car
Hi guys,
Basically I'm attempting to build a scalextric (slot car) race game - simple 2d top-down style.
The basics are easy - for now I'm using a timeline motion guide/path and adjusting the frame depending on speed etc. - this works well and I'm happy with it (although eventually I'll upgrade to dynamic paths and track builder)
The problem I'm having is that of getting the car to 'realistically' skid out on corners depending on speed - I'm doing a little calculation where I work out the difference between the car's previous _rotation and the car's current _rotation and then multiply this value by the current velocity and smooth out the result using a method very similar to the old 'smooth preloader' tutorial - this new rotation value is applied to the _rotation property of a movieclip inside of the movieclip that is following the path/guide.
This works great - except there is one point on the track where the the car does a full 360 (or just twitches) - on the demo press the UP key to accelerate and just go 'full pelt' round the track and you'll see it happen in the top left (just past the top left corner)
The problem is something to do with how i'm calculating a setting rotations (incidently i found that flash uses -180 to 180 instead of 0 to 360)
can anybody understand what is going wrong? and how to fix it?
Thanks,
Jon
Using Variable Inside A "path" To An In-library Object -warning- Semi Noob Question
I am in the process of programming an "inbox" for my game in which there are many clickable objects which you collect as you play. When you click an object:
on (release){
using=true
objectselected="lightbulb"
_root.lightbulb._alpha=10
}
so when i click the lightbulb, it looks different, and assigns a few variables.
when i close then re-open the inbox, i want the previously selected object to still be selected and "lit up" so i typed for frame one:
stop();
if (using==true){
_root."objectselected"._alpha=10
}
but it gave me a syntax error. how do i make it "find" the object i want selected if i have the variable in the "path" of the object- im pretty sure it has something to do with the "getproperty" function, so i tried
...
_root.(getproperty(objectselected))._alpha=10
}
but that din work either... how do i type this??
i hope i was descriptive enough- i will check for an answer in 30 minutes- have to eat
_rotation Issues Calculating Orientation On A Circular Path (scalextric/slot Cars)
Hi guys,
Basically I'm attempting to build a scalextric (slot car) race game - simple 2d top-down style.
The basics are easy - for now I'm using a timeline motion guide/path and adjusting the frame depending on speed etc. - this works well and I'm happy with it (although eventually I'll upgrade to dynamic paths and track builder)
The problem I'm having is that of getting the car to 'realistically' skid out on corners depending on speed - I'm doing a little calculation where I work out the difference between the car's previous _rotation and the car's current _rotation and then multiply this value by the current velocity and smooth out the result using a method very similar to the old 'smooth preloader' tutorial - this new rotation value is applied to the _rotation property of a movieclip inside of the movieclip that is following the path/guide.
This works great - except there is one point on the track where the the car does a full 360 (or just twitches) - on the demo press the UP key to accelerate and just go 'full pelt' round the track and you'll see it happen in the top left (just past the top left corner)
The problem is something to do with how i'm calculating a setting rotations (incidently i found that flash uses -180 to 180 instead of 0 to 360)
can anybody understand what is going wrong? and how to fix it?
Thanks,
Jon
_rotation Issues Calculating Orientation On A Circular Path (scalextric/slot Cars)
Hi guys,
Basically I'm attempting to build a scalextric (slot car) race game - simple 2d top-down style.
The basics are easy - for now I'm using a timeline motion guide/path and adjusting the frame depending on speed etc. - this works well and I'm happy with it (although eventually I'll upgrade to dynamic paths and track builder)
The problem I'm having is that of getting the car to 'realistically' skid out on corners depending on speed - I'm doing a little calculation where I work out the difference between the car's previous _rotation and the car's current _rotation and then multiply this value by the current velocity and smooth out the result using a method very similar to the old 'smooth preloader' tutorial - this new rotation value is applied to the _rotation property of a movieclip inside of the movieclip that is following the path/guide.
This works great - except there is one point on the track where the the car does a full 360 (or just twitches) - on the demo press the UP key to accelerate and just go 'full pelt' round the track and you'll see it happen in the top left (just past the top left corner)
The problem is something to do with how i'm calculating a setting rotations (incidently i found that flash uses -180 to 180 instead of 0 to 360)
can anybody understand what is going wrong? and how to fix it?
Thanks,
Jon
Making Character Move On Path.
Hi,
I have been trying for a bit to solve this but atm I dont have the skills to come up with an appropriate answer.
Here is the problem:
I have a character that needs to move along a certain path. The path is a basic grid almost like a chess board. Its not a direct line, its not a begin->end path its a more complex walk path. You can move up, down, left right but it has to move along the line.
The map wont always look like that, so the solution has to work between different types of paths (curved, straight etc.)
I completely give up. I hope someone has a good solution.
Random Move...orient To Path?
How do I make my MC point in the direction its moving?
This is the code
code:
acceleration = 10;
newpos = function () { ranx = Math.round((Math.random()*250));rany = Math.round((Math.random()*250));};
newpos();
this.onEnterFrame = function() {
this._x += ((ranx-this._x)/acceleration);
this._y += ((rany-this._y)/acceleration);
if (Math.round(this._x) == ranx || Math.round(this._y) == rany) {
newpos();
}
};
EDIT: I added [ as ] tags to your code for readability. See the forum guidelines. - jbum
Move Player Along A Path Using Keyboard?
Hey!
We have a project and we need to develop a game for that project. The problem is that we're all new to actionscript. What we want to do might be simple, but we find it pretty hard.
Anyway, we're going to have like a maze and you're running around on the streets. The problem right now is that we dont know how to make the players (this will be a game for 2 players) to just be allowed to run around on the streets, nothing else, and you're controlling them by using your keyboard. I've tried to use hitTest, but didn't get it to work.
Can someone please help us with this?
I've attached a illustration how we want it to look like (we are going to make it much nicer )
How To Move A Rotating MC Along A Curved Path
Can someone assist or get me started with moving a rotating MC along a curved path?
a. start off the stage at x = 1095 y = -1362
b. slide down a curved path similar to a slide at a playground
c. and end up at x = 239 y = 194
Thanks in advance...
Using Path Class: Move Object To 50%?
Yesterday I asked how to find the midpoint of a curved line and I was pointed to the excellent Path class:
http://www.kirupa.com/forum/showthread.php?t=224668
But I'm still stumped. I can trace the current location of an object to see that it's x percent of the way through the line, but I want to calculate in the other direction. I want to be able to say "put this object at 50% and put this other object at 75%".
I'm sure this is possible, but I'm not understanding how in the docs. Anyone have experience with this?
Thanks,
Jon
Move An Object Along A Curved Path With Actionscript
Howdy,
I am trying to get a movieclip to move along a path using actionscript;
This should have helped http://proto.layer51.com/d.aspx?f=952,
but to be honest I don't have a clue how to get it to what I want
I have attached an outline of the path I want the mc to take,
any help would be much appreciated and would save my sanity!!!
Thanks
Particle With Fading Trail To Move Along A Path
Hi
Im trying to create an effect similar to that used in the 2advanced web introduction for logic design where particles fly around emitting a long fading smooth trail. The seem to animate along a set path.
How can that efect be made. Im guessing action scripting is the way. I tried some very long winding and time consuming and crappy ways only to see worthless results.
Does anyone know how this can be done.
Move All Objects At Once
I have an fla that looks great. But after all is said and done, I need all items to be about 40 pixels higher. Is there a way to move all of them at once?
please answer yes..... but only if it's true.....
Tom
Two Objects Move
ok i want to get three objects to move down when i press the down key i've tried
on(keyPress "<Down>"){this&&rightbump&&leftbump._y++;}
and i tried putting
on(keyPress "<Down>"){this._y++;}
in every object
but then left and right bump don't move and paddle does
any help?
Using Key To Move Objects
Hello I trying to make a game. I like to make one of the objects move left and right with the keys "a" and "s" but I don't know how to make it do this. I know how to use the arrow keys but I need them for moving a nother object.
How do I make the game see the key beening press down and tell it to move the object??
Making A Clip Move On A Random Path, But End In The Same Place
Maybe someone can help -- still a little new at actionscript:
I have a movie clip that needs to zip along some sort of a path, but end up in the same place by frame X every time. Right now, I've drawn a random-looking path, and have it motion tweened along it, which looks fine the first time, but gets old (and the tweening is slowing stuff down).
Is there any way in actionscript to make something move randomly, but end up in the same place and the end frame?
Any help is appreciated... thanks.
Move Screen To Movie Clip On Random Path
I have made a flash file with dim of 200*100, behind it there is a background of 1000*500! on this background there are 4 movie clips (which ofcourse I may change) I have made it so that by pressing a button on the screen the screen moves to the movie clip (which is also 200 * 100) and then from that clip to another clip and so on ...
The thing I need is to create a random path to move from one location to the next! ... is that possibe? and if so! how?? The following is the script I have written to make the selected button (which is appointed to a movie clip) do its thing: (sorry for the weak codes, this is actually my first actionscript code) if anyone can give optimize my code it will be excellent!
PHP Code:
function moveTo(clip, speed) {
xtarget = clip._x-clip._width/2;
ytarget = clip._y-clip._height/2;
var speedX = Math.abs(xtarget+_x)/speed;
var speedY = Math.abs(ytarget+_y)/speed;
//--------------------------- x ---------------------------//
//left
if (xtarget<0 && _x>0 && (-xtarget-_x>0)) {
var i = 1;
}
//right
if (xtarget<0 && _x>0 && (-xtarget-_x<0)) {
var i = 2;
}
//left
if (xtarget<0 && _x<0) {
var i = 3;
}
if (xtarget<0 && _x == 0) {
var i = 4;
}
//right
if (xtarget>0 && _x<0 && (xtarget+_x>0)) {
var i = 5;
}
//left
if (xtarget>0 && _x<0 && (xtarget+_x<0)) {
var i = 6;
}
//right
if (xtarget>0 && _x>0) {
var i = 7;
}
if (xtarget>0 && _x == 0) {
var i = 8;
}
//--------------------------- y ---------------------------//
//up
if (ytarget<0 && _y>0 && (-ytarget-_y>0)) {
var j = 1;
}
//down
if (ytarget<0 && _y>0 && (-ytarget-_y<0)) {
var j = 2;
}
//up
if (ytarget<0 && _y<0) {
var j = 3;
}
if (ytarget<0 && _y == 0) {
var j = 4;
}
//down
if (ytarget>0 && _y<0 && (ytarget+_y>0)) {
var j = 5;
}
//up
if (ytarget>0 && _y<0 && (ytarget+_y<0)) {
var j = 6;
}
//down
if (ytarget>0 && _y>0) {
var j = 7;
}
if (ytarget>0 && _y == 0) {
var j = 8;
}
//--------------------------- ---------------------------//
clip.onEnterFrame = function() {
trace(buttons._y);
if (i == 1 || i == 3 || i == 4 || i == 6) {
_x += speedX;
buttons._x -= speedX;
}
if (i == 2 || i == 5 || i == 7 || i == 8) {
_x -= speedX;
buttons._x += speedX;
}
if (j == 1 || j == 3 || j == 4 || j == 6) {
_y += speedY;
buttons._y -= speedY;
}
if (j == 2 || j == 5 || j == 7 || j == 8) {
_y -= speedY;
buttons._y += speedY;
}
if (i == 1) {
if (-xtarget-_x<0) {
buttons._y = buttons._y+(this.height/2);
delete this.onEnterFrame;
}
}
if (i == 2) {
if (-xtarget-_x>0) {
buttons._y = buttons._y+(this.height/2);
delete this.onEnterFrame;
}
}
if (i == 3 || i == 4) {
if (xtarget+_x>0) {
buttons._y = buttons._y+(this.height/2);
delete this.onEnterFrame;
}
}
if (i == 5) {
if (xtarget+_x<0) {
buttons._y = buttons._y+(this.height/2);
delete this.onEnterFrame;
}
}
if (i == 6) {
if (xtarget+_x>0) {
buttons._y = buttons._y+(this.height/2);
delete this.onEnterFrame;
}
}
if (i == 7 || i == 8) {
if (xtarget+_x<0) {
buttons._y = buttons._y+(this.height/2);
delete this.onEnterFrame;
}
}
};
}
Path To Sound Objects
Hi, first post here so any help much appreciated.
I have a main swf, lets call it main.swf ! and into I am loading an external swf called...external.swf. This external swf has sound objects in it that need to play when a user rolls over a button contained with in external swf.
I've defined my sounds in the root timeline of the external swf like this:
firstSound=new Sound();
firstSound.attachSound("kitchen1");
and set up the linkage from the library to those sounds, the sounds are contained in the library of the external swf
When the mouse rolls over a button I activate the sound using:
firstSound.start();
When this is played as a stand alone file ie: when i test the external swf without it being loaded into the main.swf, it works fine and dandy, but when I go through the main.swf, load in the external.swf and try the rollover nothing happens. I know this is something to do with the paths and I've tried lots of variations on the buttons by adding 'this' or '_root" and tried adding those to the sound definitions as well but to no avail !! I'm guessing this is pretty easily fixed but I'm afraid I'm at a loss to do so....any and all suggestions welcomed.
Thanks.
LS.
How Do I Move Objects With The Keyboard?
I know its a stupid question.
I draw something on a frame and make it a symbol(Button)then I add an action to it:
I select on (KeyPress) <Right>
SetProperty, _x(XPosition), 10
so when I press the right arrow it moves 10 pixels right.
BUT my question is how can I make it so that If I press the right arrow again my symbol will move again, and also should I make the picture a button or what?
any help is greatly appreciated.
Objects To Move In Front And Behind Each Other
I've been trying to work out how to have a load of buttons (which enlarge to fill most of the screen on rollover & which are all on one layer) also move in front of all the rest of the buttons on rollover, so that the other buttons are no longer visible. Currently, when they enlarge, depending on where they are arranged - front to back - there may or may not be other buttons visible in front of them. I presume it's possible to attach an actionscript which sorts this out, but I've been looking for ages and still no luck!
Any Ideas?
? - Move Objects On Elipse Via AS
So, my coworker has been challenged with rotating some objects around an elipse. Somewhat similar to moving the planets around the sun but all on the same elipse. Then, as the object comes to the foreground we will make the object bigger so it stands out.
Anyone willing to share some code or know of a new component that would do this?
Any help would be appreciated.
Thanks,
Jason
How Do You Move Objects Across Stage?
Hi i can't seem to move the picture to the stage..I loaded the picture in but when i press play all it does is show the picture...i want the picture to load to the x and y cordinates of 0,0 (center of stage) and it doesn't matter where the starting point is...can somebody please help? Here's the code so far...please tell me what i should do to fix the problem
var startX:Number = myImageHolder._x
var startY:Number = myImageHolder._y
var endX:Number = 0;
var endY:Number = 0;
myImageHolder.onEnterFrame = function () {
if (this._y > endY && myImageHolder._x > endX)
{
myImageHolder._y += ((endY - startY)/100);
myImageHolder._x += ((endX - startX)/100);
trace("x/y start:"+myImageHolder._x+"/"+myImageHolder._y);
trace("x/y end:"+endX+"/"+endY);
}
}
// create the XML variable
var xml:XML = new XML();
xml.ignoreWhite = true; // you must ignore whitespace
xml.onLoad = function() { // the function that is called when the xml is loaded
var nodes = this.firstChild.childNodes; // tells you the number of child nodes
numOfItems = nodes.length; // tells you how many items you have
for (var i = 0; i<numOfItems; i++) { // attach icons
myImageHolder.loadMovie(nodes[i].attributes.image);// attach image to the myImageHolder MovieClip
nextimage();
myText.text = nodes[i].attributes.caption; // set the text
}
}
xml.load("xml/images.xml");// load the xml
|