How To Make Objects 'snap' To A Location
I was wondering how to make an object snap to a specific location when dragged to an approximate area. For example, when dragging a solid circle to an outline of itself, the circle would snap perfectly in place when user releases the button. Is there a built-in mechanism that allows for this. I already know how to drag and drop. Any help is appeciated.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 02-28-2004, 03:38 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Making Objects Snap
I have a childrens collage program that basically is a FLASH Mr. Potato head. you have a figure on the stage and a list of items ie, nose, hair, lips, eyes and so-on.
The problem I am having is I want these objects to snap into place or be able to snap to another object for example I have a set of eyes on the stage and I want to add glasses I would want the glasses to snap to the eyes so they are aligned correctly...
Matt
Snap To Objects Oddness ?
Hi there, when i edit an existing symbol, for some reason snap to objects stops working ! Is there any reason for this as its definetly turned on. When i go back to the scene from symbol editing mode it starts working fine again. Any ideas ??
Thanks alot
Paul J
Snap Objects To Desired Position?
What I'm basically trying to do is use the snap feature in flash during runtime.
I have a diagram of a rack that holds all of our servers, switches, etc and a bunch of pictures of the different models in flash. I want to be able to drag the pictures and have them snap into a place in the rack so anyone could reconfigure it very easily.
I was just wondering if anyone could explain how this might be done, or if anyone had seen anything like this I could download or take a look at.
I think it could also be done using DHTML.
Thanks for any input.
Snap To Objects Type Thing
i am making a thing where a bunch of square shaped movie clips will be placed on the desktop, and will be draggable. i was wondering if there was a way to get them to stick together... similar to the snap to objects tool... like say i am dragging one and i want to make a large square out of the smaller squares... i want them to snap together... any ideas?
Snap/Align Objects Dynamically
How do I snap/align objects dynamically? For instance, if I have an image loading dynamically and a text box directly below, I want the text box to always touch the edges of the image loaded (regardless of the image's size).
Making Movie Clips Snap To Objects
How do you make a movie clip snap to an object in a certain place once they are close. Or if they are too far away have them return to thier original postition? I made this for my son (i.e don't use it) http://portfolio.iu.edu/migomez/bodymixup.html
Right now you can just place stuff anywhere you want. I want to be able to have the objects hit a certain position when you get close to the body.
Drag And Drop Objects That Snap Into Place
Hello! I'm new around these parts (I literally signed up about 3 minutes ago!). I'm a high school student who just started using Flash about a month or two ago, so I'm far from advanced, though I have tackled some of the basics. In class I'm working on an art portfolio site but in my spare time I'm making a virtual dress-up doll (you know, the kind where you can pick up the clothes and drop them on the figure to mix and match outfits). Learning how to make drag-and-drop objects was very easy and there are lots of tutorials on it but what I can't figure out is how to get objects to "snap" into place. I want it so that the doll's hairdo's snap into position because they look kind of stupid when placed incorrectly.
Thank you so much, to anyone who can help! I've looked everywhere but haven't been able to find a tut on this >_<.
How Do I Specify A Location For Objects?
I am trying to create a flash with a header text with an effect. Then after the effect is ran, I want the text to remain while a second line of text runs its effect. Then I want the first two pieces of text to remain while a third piece of text runs its effect, and so on.
I did this by putting the first text with effect in key frame 1. Then in key frame two, I put the same text without an effect PLUS the second piece of text with an effect, and so on. The problem is I can not quite get the text to line up exactly with the text in the previous key frame so it is a little choppy. I can see what appears to be the location of the text on the bottom tool bar, but I can not find out how to change it.
BOTTOM LINE - Is there a way to specify a piece of text, object, or whatever else to be a set number of pixels from the edge and top?
How To Make Lines Not Snap Together
..ok, i knwo this is no problem for u advanced flashers, so please please respond to this post. ok, heres my problem: all i want to make is a stick figure picking up a spraypaint can. so when i make him touch the ground, his arms have to go past his legs, but in the next keyframe when i want his hands to go back up to his waist, half is arm is connected to his leg...i hope guys understand what i mean =. so what i simply want is to make it not connect like that. i already un-checked the "Snap To Object" thing, or whatever...but its still snapping together. so please, any help on my stupid post would be greatly appreciated. thank you to all in advance.
How To Make Lines Not Snap Together
..ok, i know this is no problem for u advanced flashers, so please please respond to this post. ok, heres my problem: all i want to make is a stick figure picking up a spraypaint can. so when i make him touch the ground, his arms have to go past his legs, but in the next keyframe when i want his hands to go back up to his waist, half his arm is connected to his leg...i hope guys understand what i mean =. so what i simply want is to make it not connect like that. i already un-checked the "Snap To Object" thing, or whatever...but its still snapping together. so please, any help on my stupid post would be greatly appreciated. thank you to all in advance.
Moving Different Objects To One Location
Howdy, i have the following problem
First Object: x100 y100
Second Object: x400 y400
Thrid Object: x200 y200
when a counter reaches a certain number they all have to move to
x300 y300
how can i do this via AS??
any help
thanx in advance
Location Of Shared Objects With Associated .exe File
Currently I have a .swf file located on my desktop and the location is:
c:Documents and Settings imDesktopjournaljournal.exe
the location of its associated shared object is:
c:Documents and Settings imApplication DataMacromediaFlash PlayerLocalhostDocuments and Settings imDesktopjournaljournal.sol
2 QUESTIONS:
1) Is it possible to have the shared object travel with (Attached to) the executable so that information stays with the .exe no matter where it sits?
2) Is it possible to have the shared object in the same folder as the .exe file so the the path to the .sol file looks the same.
Shared Object:
c:Documents and Settings imDesktopjournaljournal.sol
Executable:
c:Documents and Settings imDesktopjournaljournal.exe
Thanks for your help!
Shared Objects File Location
just a quickie, ive been using shared objects which are working fine but im curious as to where the SO files (*.sol) are stored. i read they are by default kept in the same dir as the flash player but i cant see them.
in fact ive done a search for all *.sol files on my pc, nothing. they should be somewhere though, doing their job in flash fine.
any ideas?
Moving An Object To Another Objects Location
hi, i am creating a vertical shooter adaptation.
i am trying to create the enemy units to fire in a direction at the main unit.
The problem is that the bullet follows the main unit instead of moving in a straight direction where the unit used to stand.
I am using timers for creating the animation and i have tried changing the rotation of the bullets. I have got it to rotate in the direction i want it to but it doesnt move there.
i am also trying out this temp object thing where an object is left at the main units last location and the bullet travels to that location. its not working yet but i am going to give it another try.
Make Drag N' Drop Snap Into Place
I am wondering if anyone has the code to make my drag and drop movie clip "snap" into place when it roles over another (given) movie clip.
Here is the code that I am using so far. It is located on an invisible button inside the movieclip which is being dragged in the main time line:
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
if (_droptarget eq "/one") {
gotoAndStop ("p1");
} else if ( _droptarget eq "/two") {
gotoAndStop ("p2");
} else if (_droptarget eq "/three") {
gotoAndStop ("p3");
} else if (_droptarget eq "/four") {
gotoAndStop ("p4");
} else {
gotoAndStop ("p5");
}
}
If this is not clear, please let me know. I am getting desperate, and can't find a tutorial with a clear answer.
Thanks. Gabrielle
How To Make Two Lines Snap To Your Mouse Cursor?
How to make two lines snap to your mouse cursor?
Example: http://www.kirupa.com/developer/mx/specialfx.htm
the flash file on the top ( small one )
Can anyone teach me and provide me with the code?
Shared Objects Location On A Hard Drive
I am developing an interesting site and would like to store user information for repeat customers. I stumbled across shared objects and understand the concept quite well with the exception of where the files will be stored on a users hard drive. If I create a shared object does the clients computer automatically store it in some default directory?
I read somewhere that it is WindowsApplication DataMacromediaFlash Player
But when I searched my computer there was no such folder to be found. It must have been for earlier versions of Windows. Could someone elaborate on where a shared object will be stored, and if the clients computer just knows where to store the object when it is playing a flash movie? Or do I have to manually specify the directory on the clients machine?
Thanks,
Sam
Make Square Snap Back To Different Position After Button Is Clicked.
I can't figure out how to do this, I have tried a bunch of different things and none of them work, maybe someone will have an idea. Basically, I have a navigation bar created in flash, you roll over a button, the square daintily floats over to it using code, not motion tween. Then when you roll off the button, the square floats back to home. I want, when I click on another button, for the square to then always snap back to the button that was clicked on, and float over the other ones on roll over. Below is the flash file of the nav bar. Thanks for your time.
Make Square Snap Back To Different Position After Button Is Clicked
No one could give me the answer in the Flash MX forum. This is either an actionscript issue or javascript, can't really tell the two apart. Anyway, I can't figure out how to do this, I have tried a bunch of different things and none of them work. Basically, I have a navigation bar created in flash, you roll over a button, the square daintily floats over to it using code, not motion tween. Then when you roll off the button, the square floats back to home. I want, when I click on another button, for the square to then always snap back to the button that was clicked on, and float over the other ones on roll over. Below is the flash file of the nav bar. Any suggestions including pointing me to tutorials will be greatly appreciated.
Objects That "snap To" Other Objects
Hey y'all,
Anyone know of the best way to script a symbol to "snap to" another symbol, within the published swf? (similar to the way you can set objects to snap to the grid in the Flash UI)
It's for a puzzle game.
Thx
Make MCs Go To A Certain Location
Ok, so I have a button (called "MC_Star") that can be dragged around, and when a certain other button is clicked, I want MC_Star to go from wherever it is to the top center, just out of frame. What I have now only allows it to move relative to where it is. Here's the code:
Code:
//Enterframes
MC_Star.onLoad = function(){
easeSpeed = 0; // the higher, the slower
target_xscale = target_yscale=100; // start at a scale of 100%
};
MC_Star.onEnterFrame = function(){
_xscale += (target_xscale - _xscale)/easeSpeed;
_yscale += (target_yscale - _yscale)/easeSpeed;
};
//Functions
MovieClip.prototype.mfade = function(prop, de, rem) {
this.onEnterFrame = function() {
for (i in prop) {
this[i] += (prop[i]-this[i])/de;
}
};
};
MovieClip.prototype.aligncenter = function() {
this.xt = Math.round(Stage.width/2-this._width/2);
this.yt = Math.round(Stage.height/2-this._height/2) - 350;
this.mfade({_x:this.xt, _y:this.yt}, 5);
};
MovieClip.prototype.stageresizealign = function(listenername) {
this[listenername] = new Object();
this[listenername].clip = this;
this[listenername].onResize = function() {
this.clip.aligncenter();
};
Stage.addListener(this[listenername]);
};
MC_Star.aligncenter();
MC_Star.stageresizealign("MC_Star");
stop();
I think I know WHERE the problem is, I'm just not sure how to make it do what I want. In the Functions section, MovieClip.prototype.aligncenter is what gives the location.
I thought by checking for the center of the stage, then telling the y to go up 350 pixels (WELL more than half the height of the stage), it would work, but rather the star simply moves over and up relative to its original position, not wherever its been dragged to.
How might I tell the star to go to a position on the stage, not relative to where it is or was?
Load Movie Make It Go To Specific Location
I'd like to load a movie (separate file) into an existing file, but I'd like to make it go to a specific location within the loaded movie.
Example: I have a home page file that has thumb nail images that I'd like to lnk to respective portfolio pieces from another file.
Is this possible to do with ActionScript?
Make Flash Object Move To Specified Location
I have a navigation setup in which I want a bar to follow the cursor when the cursor enters the navigation box area itself. (Basically it will follow up and down only. My question is when the cursor gets within the general vicinity of a menu item, I want the rolling bar to move to exactly over the menu item. So even if they don't have the cursor exactly over say, "Home", it would still move the bar exactly over it with the assumption that this is the menu choice they want. Hope this makes sense!
This is the code I have so far:
function moveMask () {
if(_root._xmouse >= 820 && _root._xmouse <= 1000 && _root._ymouse >= 80 && _root._ymouse <= 400) {
Bar._y -= (Bar._y-_ymouse)/5;
if ( Bar._y >=318){Bar._y=318;}
if ( Bar._y <= 110){Bar._y=110;}
if ( Bar._x >=1000){Bar._x=1000;}
if ( Bar._x <= 820){Bar._x=820;}
}
}
Navigation.setMask(Bar);
Thanks,
Dave
How'd U Make An Object Snap 2 Its Original Pos On An Object Thats Moved?
I'm working on a school project using Flash mx that needs a scrolling inventory. I know how to get an object to snap back to its original position from a drag, but how would you get it to snap back to its original position on an object that has moved? ie. On a scrolling menu?
//script to have a spanner remove a head and snap back to position if it doesn’t touch the head on release:
//attach to object
onClipEvent (load) {
spanx = _root.spanner._x;
spany = _root.spanner._y;
}
//action inside clip
on (press) {
startDrag(this,true);
}
on (release, releaseOutside) {
if (this.hitTest(_root.dismantle.head) & _root.head_switch=="hollow") {
_root.spanner.gotoAndPlay(2);
_root.dismantle.head.gotoAndPlay(2);
this._y = 185;
_root.airbrush._x= _root.airbrush.airbx;
_root.airbrush._y= _root.airbrush.airby;
}
else {
_root.spanner.gotoAndStop(1);
this._x = spanx;
this._y = spany;
this.gotoAndStop(2);
}
stopDrag();
}
how would i script a scrolling inventory from which I can drag and drop objects that snap back to the same pos in the inventory even tho its moved? You can see the inventory on the right of the attached jpeg.
How To Move An Object Slowly And Smoothly From Location 1 To Location 2?
Hi,
I am new to ActionScript. I wish to use ActionScript to move an object slowly and smoothly from location 1 to location 2.
I learned that I can use the following to move an object to location 2 (x2, y2):
mThisObject.x = x2;
mThisObject.y = y2;
However the object just "swift" from location 1 to location 2, not moving slowly and smoothly from location 1 to location 2.
Could some experts here provide a guideline for me?
Thanks and best regards
Alex
How Do I Make Objects Moveable?
Hi I hope somebody can help me please.....
What I want to do is be able to move objects around the screen on mouse click....I have a doll and want viewers to be able to dress/undress her in various attire....how do I go about setting that up in FLASH 5??....please remember I'm stoopid
How Do You Make Objects Invisible
its pretty simple what im trying to do its just i havnt touched flash in a year so i forgot how and the lame tutorial doesnt explain it. ive used this before in my movies but im looking at em now and i cant remember for the life of me how to do it ><. the effect is to make an object (picture or text) motion tweed from being invisible or like 50% faded to being 100% showing. did they remove an effect tool bar in flash mx cuz i swear flash 5 had a bar for doing tints, color tweeks, and opacity on tweeded objects(buttons,movies,image etc)
[F8] How To Make Objects Dissapear
Im here to ask something.
How do you make an object dissapear when you press on something else?
Im trying to make a website, and i can't find a code that does that.
I have No clue what to do.
:[
Help!.
Lazz..
Make A 'fountain' Of Objects...
Hey there, how would I go about making a certain object spray out from a particular point?
I'm thinking in particular like adverts I've seen from Orange and O2, with little text message icons spraying out from a source. I'd also like to achieve the same thing but to use the mouse position as the source, and cause the spraying to start on a click, and have the objects fade out.
Any ideas or links towards tutorials that would be of help?
How Do I Make Objects Solid So Te Car Cant Go Through Them?
I've made a car move around with the kyboard buttons, but i want to make objects that the car cannot pass through and hopefully bounce off how would i go about that?
I want to see if i could use the the flash drawing engine as well, so that they could draw their track then it would be solid, so they can race the car round in it? is that possible?
Mayan
How Do I Make Sound Objects Independent?
I have 3 sound objects playing simultaneously (drums, bass, and synth) and I want three buttons to mute each one individually, yet when I do a sound1.setVolume(0)to one of them it applies the setVolume method to all three. Is the setVolume method only global?
John
(AKA Bingo the Clown)
http://mechasonic.com
How To Make Text Objects Clickable
(hope it's true there are no dumb questions here)
i am learning flash, using insane flash animator 2.5
trying to make a navbar and would like to make the individual text items clickable - to open a new url when the user clicks on the word
and have no idea how to start - i'm guessing i need to use one of the action elements but which one? and how? if anyone uses this darned thing or knows where there might be a step by step tutorial for TOTAL newbies like myself i would appreciate it very much
Can I Make Objects Outside Of The Stage Visable?
i made a dropdown menu for the top of my website. the problem is the links list is a bit lengthy and goes off of the stage. so is there a way for those links to remain visable even if they extend off of the stage and even go over other html stuff on my page?
How To Make Objects R Scenes Slowly Appear
hi....
I am very new to flash n want to know
How to make the object appearing slowly or increasing the brightness
And i had created 2 scenes but the 2nd scene is coming all of a sudden into picture how to make this scene slowly appear
kindly plzzz. help me in this
How To Make Linked Objects With Lines
I would like to create something similar when you create a Entity relationship Diagram for a Database. Do you know of any tutorials that might help me?.
- Drag and Drop (very Simple)
- Lines that are created when I link two Objects
- Lines Move when I move an Object that is linked to other Objects
And How can I use XML to save the data.
Please help me If you know tutorials that might help me acomplish thsi task
Thanx in advance
[F8] How Do You Make An Outline Effect On Objects(I Have An Example Of What I Want)
Hi Everyone,
How do you dynamic outline effects on objects in Flash CS3.
I want to do the outline effect exactly like this example.
Also in that example, they have a neat little text effect, how would you do that?? I imagine it is not that much different than the text effect. Is there a name for that kind of effect???
THANK YOU SO MUCH FOR EVERYONES HELP, I REALLY APPRECIATE IT!!!!
THANKS IN ADVANCED
-- David
How To Make Time Sensitive Objects?
I have not used Flash MX for a couple months so I'm kinda rusty...anyway, I was wondering how to make an object change according to the computers REAL TIME, I've searched everywhere so far and no luck, hell I've even tried if statements but I'm a little rusty on Actionscript...can any1 help?
Hiding Objects And Make Them Active
Dear all ,
I want to know if I have two instances of the same movie clip and they are rendered one over the other, the image not visible will impact performance at the same way the one visible. My question is because I am trying to detect collision using invisibles mc over the real one, but after I set visible option to false, detection can not be achieved, so I was thinking just to render the collision object under the real object. However I am concern about performance.
One suggestion I got was to set alpha to 0. This is the best way to do it?
I am using getObjectsUnderPoint to detect collision object.
Thanks in advance
Hiding Objects And Make Them Active
Hi all,
I am using getObjectsUnderPoint to know if an object is colliding. I need to hide the objects to collide with, however if I set visible property to false getObjectsUnderPoint does not work because the objects are inactive.
How I can not render an object and the same time to let it be active?
If I render the original object over the object to collide with, this will take computing resources?
Thanks in advance
|