ActionScript 2.0 :: Custom Drag And Setting Boundaries?
Aug 22, 2009
I'm using a custom drag for easing properties:
ActionScript Code:
var yMouse:Number;
var xMouse:Number;
onEnterFrame = function(){
yMouse = _root._ymouse;
[Code]...
As you can see, I'm trying to prevent it from passing _root.block by only allowing the mouse's Y to be followed when it isn't passing _root.block. The only problem is that once it hits _root.block, there's no way to drag it back from _root.block. It gets stuck. Is there a better way to prevent it from passing _root.block but allow it to be pulled back from _root.block
View 1 Replies
Similar Posts:
Nov 12, 2009
I am trying to create a movieClip that will always stay on a track. You get me, or have a lost you?Picture the London underground map, I want a little circle that will follow the track BUT also follow my cursor.So if I drag the circle to the right it will go to the right but always stay on track even if there are slopes or corners in the track.
View 3 Replies
Jun 8, 2009
I am attempting to create a map that has the ability to zoom in and out as well as a click and drag feature.What I need help on is setting boundaries for the map. I can set them for the map when it is zoomed out, but they need to change as the map zooms in. I've been searching lots of forums lately to see if anyone can help, but no luck yet...
View 1 Replies
May 14, 2006
I have a movie clip that can only move to certain parts in the stage. For this I used another movie clip that supposedly should constitue the rectangle constraint. But this doesn't seem to work !startDrag(this,true,bounds._x,bounds._y,bounds._x+ bounds._width,bounds._y+bounds._height);
View 2 Replies
Aug 2, 2009
I'm a noob on this forum & pretty desperate now. I've been on a research & trial&error odyssey for days now, but this problem remains unsolved. I am creating a game with an mc (say "target_mc") randomly moving around. Everything is working beautifully, except for one thing: My stage was initially 900x600 and the game took up all of that space. target_mc's movement was accordingly set for a width of 900 and height of 600.
I have now resized the stage height to 958 with the game (still 900x600) being centered vertically. The top border is now at 170.8 (y). The bottom y border is at 770.8. But target_mc still thinks the top border is at 0. As a result, it is still covering the same area as before, hence floating off the actual game area into the stage margin area between 0 and 170.8. As I have other frames following which require my new and larger stage size, going back to the original 900x600 is not an option.
I have tried and tried but not managed to tell target_mc to keep its random movement within <=170.8 and >=770.8. I have tried all variations of "if statements" and other tricks at my disposal. And since I'm not an expert, I'm at my wit's end. Everywhere I looked, the solutions offered were for draggable objects or cursor movements, but not for movieclips moving randomly as soon as the frame is loaded. My script & codes are very, very elaborate and there is a lot happening on the stage, so a mask is not an option for me. Surely there's got to be a way to set variables and commands in the script...? I just don't know which to go for...
Do I work with some kind of math involving the total stage height of 958? I have tried setting variables for xMin, xMax, yMin, yMax, but must have done something wrong in implementing them in the rest of the random motion code cos nothing worked.
View 3 Replies
Oct 5, 2004
I'm moving this little red box along the x axis. It just moves w/ the mouse but it moves off the movie clip area, I want to be able to set the left and right boundaries.
Heres my code.
mc_movingBox.onEnterFrame = function() {
var xMouse = _root._xmouse;
if(Math.abs(xMouse - this._x) < 1) {
this._x = xMouse;
} else {
this._x -= (this._x-xMouse) / 6;
}}
View 6 Replies
Dec 12, 2006
I used Kirupa's drawing board tutorial, but when I finished making the flash file I wondered if there was a way to limit where the viewer can draw. For example, on his tutorial he shows you how to create an easy erase button. Well, what if I don't want the viewer to be able to draw on the button. Is there a way to specify the area that you want the viewer to be able to draw on? I tried making the space a movie clip and just adding the actionscript to the movieclip, but when I placed the movie clip inside a bigger flash file it wouldn't let me draw at all. I thought making it a movie clip would then limit the drawable area. Did I do a good enough job explaining my problem? I just want to be able to limit where the viewer can draw, so that the viewer can't get wild and draw all over the buttons and controls.
View 1 Replies
Oct 5, 2004
I'm moving this little red box along the x axis. It just moves w/ the mouse but it moves off the movie clip area, i want to be able to set the left and right boundries. Heres my code..
mc_movingBox.onEnterFrame = function() {
var xMouse = _root._xmouse;
if(Math.abs(xMouse - this._x) < 1) {
[Code].....
View 6 Replies
Jul 2, 2009
I have created this swf that allows me to drag my movie clip around with easing effects.However, if I drag it too fast, my movie clip will actually goes out of my "flash".PS: I actually got this script from a user in this forum. Sorry about that. Hence, i left the credits there.)Is there anyway where I can set the boundaries where the movie clip can be dragged to? I've came across a website where the effect of dragging within a specific area is exactly what I desired.Also, I'm using AS2 and here it is.
//Tutorial criado pela Cabana Cro: www.cabanacriacao.com
//Visite tambm o Cabanoblog: www.cabanacriacao.com/blog
_root.myMC.ease = 5;
[code].....
View 1 Replies
Nov 3, 2011
What i am trying to do is move a MC around by dragging it, but i dont want the MC to move so far that it could be lost on the stage. i need some sort of parameters so that the MC is always showing. basically i have a large map of the united states and i want to be able to move it around and look at the individual states. the map is much larger than the stage and i am using a mask to clean up the appearance. i just want to make sure that the user cant move the map so far in one direction that it gets lost.
View 3 Replies
Jun 1, 2010
I know how to set boundaries for a drag and drop, but is it possible to have one of corner of an MC stay anchored, thus forcing the mc to rotate around it like the hands on a clock? (I only need the MC to rotate about 90 degrees).
View 5 Replies
May 18, 2011
I'm making an image revealer in flash, but I can't wrap my head around how to constrain the slider bar to the area_mc. Mainly in the mouseMoveHandler. Can someone please give me some pointers?[code]...
View 1 Replies
Jun 28, 2010
I have an object in my program that you can click drag. However, I want to set a boundary for this object so that you can't drag it outside of a certain area. Using a standard if statement to check the coords of the object and reset them doesn't work as that causes a bouncing effect.
View 3 Replies
Jun 29, 2010
I have a movieclip that is locking to mouse center when dragging it. I know how to set up the boundary code, though the movieclip images are different sizes, so didn't want to have to create a custom code such as:t.startDrag(true, 290, 85, 910, 390);for each movieclip.does anyone know how to constrain the draggable item to within the left, top, right, bottom boundaries inside of a movieclip?
View 1 Replies
Oct 15, 2009
I'm new to flash and I am just trying to create a draggable object. Easy right? Sure looks like it should be simple.
So I do this:
on (press) {
startDrag (this);
}on (release, releaseOutside) {
stopDrag ();
}
Then I do Test Movie and when I click and drag, the ENTIRE CANVAS drags. The object I set the action for AND every other object on the canvas moves.
View 5 Replies
Apr 21, 2009
i never use compenents, and was recently asked to build one. Ha. Anyway, i have a working class that does all i expect, however, when transforming the class to a component, i am having trouble getting the inspector to actually 'set' the variables. below is a very general idea of what i am doing. All the variables show in the spector, but only the default values are working at runtime.
[Code]...
View 2 Replies
Mar 7, 2011
How can I set a custom font while creating a link with TLF text? Here is my code:
[Code]...
Everything works fine but I would like to use:
- Helvetica Neue Bold as my custom font
- Add tracking or letter spacing
- Embed the font in my swf
View 0 Replies
Mar 20, 2009
This animation is for a kindergarten course. I have 6 different colored teddy bears on the
floor and the bears are to be placed on the middle shelf in the room, in no particular order. I have the code in place to drag the bears, and they return to their original location if dropped in the wrong area. Everything works, except I can't make the bears stick to the target area. The target area has to be the same for all 6 bears.
View 17 Replies
Dec 11, 2009
I am trying to define the content area of a custom component that extends mx:VBox. The component has predefined headers and footers (visual children) and I want to set the area in the middle for adding children to the component. The component will be used like this:
<custom_component>
<mx:button/>
</custom_component>
How would I set this content area?
View 3 Replies
Nov 19, 2011
I made a custom LabelItemRenderer, inside it I want to give some additional style to a StyleableTextField. How can I do it without losing inherited styles? I tried different things, but always got an error saying antiAliasType must be set.
s|List.customListStyle
{
fontFamily: Arial;
[Code].....
How should I set my text field style, and then set it in the createChildren method?
View 1 Replies
Sep 1, 2006
i am trying to make a custom class that has a small number of variables but I can't seem to get the array part to work.[code]I can't seem to get it to work. I can set and access the other variables OK its just the array thats giving me problems.
View 2 Replies
Mar 10, 2009
I have just created a custom AS3 Component to use in an MXML project.[code]but then i lose some re usability.What do i need to do to be able to set properties from mxml?
View 3 Replies
Jun 15, 2010
I am running Flash Media Streaming Server 3.5.1 r516 on a CentOS system. I also have WHM/cPanel installed on this system. My scenario is this. We have a large number of MP4 media files that are currently located in a web root directory created by cPanel: /home/mediafa/public_html/fullservices. These all work without a problem when doing progressive downloads. However, we also want to make them streamable with FMS as well. From the documentation, I should be able to create an entry in the /<fms install dir>/applications/vod/Application.xml file to look up files in that folder.
Here is my VirtualDirectory block:
<StreamManager><VirtualDirectory>
<!-- Specifies application specific virtual directory mapping for recorded streams.-->
<Streams>/;/home/mediafa/public_html/fullservices</Streams>
<Streams>/;${VOD_COMMON_DIR}</Streams>
<Streams>/;${VOD_DIR}</Streams>
</VirtualDirectory></StreamManager>
However, when I try to connect to a file that is in that directory, I get a 404 error in the access.00.log file. I've tried to change the owner/group on the fullservices folder as well as the owner/group of the target file to the fms user/group, but I still cannot connect to it. The connection address is rtmp://<ipAddress>/vod/mp4:1005-03m_256k.mp4.
View 1 Replies
Dec 9, 2009
I am trying to develop a custom component to act as a divider.
[Code]....
I would like to use this component to assign objects like this:
[Code]...
Unfortunately, this does not work. I get a compiler error saying: In initializer for 'left': multiple initializer values for target type mx.containers.Canvas.
View 1 Replies
Aug 18, 2010
How do you set the default value of skinClass for a custom component in Flex? I've extended the DropDownList with my custom component, but I would like to specify a default skin to go with it instead of always setting the skinClass value for each instance.
View 1 Replies
Jul 20, 2009
I'd like to implement a custom drag on an AdvancedDataGrid tree structure, which only allows the drag on the branches (not leaves).I'm having much difficultly with this, trying to use the MouseDown event, but not having luck! I think I've got the mousedown able to figure out if the item is a branch of leaf. Any help on how to perform the custom drag with an advanceddatagrid?? [code]
View 2 Replies
Jun 20, 2011
I am trying to use the Flash + Set the browser to a desktop agent on the Galaxy Tab.
mWebview.getSettings().setUserAgentString("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11) Gecko/20101019 Firefox/3.6.11");
mWebview.getSettings().setPluginsEnabled(true);
So the issues is, when the UserAgentString param is enabled, flash player wont load as many websites like Iplayer don't recognise the browser in the WebView.
This may be a bug in the Samsung browser. Anyone have any desktop agents that the WebView will accept whilst enabling flash?
View 1 Replies
Oct 15, 2010
I'm doing the drag an drop of an ItemRenderer manually (DataGrid) and want to know how to generate a custom DragProxy of a component that hasn't been added to the display list.
I tried something like this but didn't work:
private function doDrag(event:MouseEvent):void
{
var dragSource:DragSource = new DragSource();
[Code].....
So, I want to be able to create the DragProxy using a component, the button is just an example.
View 1 Replies
Apr 8, 2009
I prefer to build custom drag functions using the TimeEvent etc. Below I have some code where as when I click on a MovieClip it fires the imageStartDrag function which then begins the imageDrag function consecutively.Currently when I click and drag it moves the image fine, however it is snapping to the far left of the image.What I would like is to be able to click and drag so that the image drags from it's original point. My brain is a bit confused, what do I edit in 'imageLoader.x = mouseX;' to have it starting from it's original position and moving. (Note, I'm only testing with the X Axis atm, later it will use the Y Axis too.)
Code:
// Image StartDrag Handler.
private function imageStartDrag(e:MouseEvent):void {
[code]......
View 1 Replies
Nov 3, 2010
I have adapted some script that enables some easing on drag of an mc, My issue is how do I add bounds the the drag. I have added two variables (leftX and rightX) but I don't know what to do from here.
Code:
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.events.Event;
[code]....
View 1 Replies