Random move with dragable in bouded area
respected sir i m doing hard work since 6 months,u r god 4 me
,if u help me..plzzz
My prb : i want make a object (random movement with dragable
in bounded area like a farm hause.
----------------------Bounded movement
onEnterFrame = function() {
with (_root.yash){
x1 = _x;
y1 = _y;}
var shapeFlag = true;
if (_root.dragArea.hitTest(x1,y1,true)) {
if (dragArea._x < yash._x-20){
yash._x = dragArea._x+(yash._x-100)
} else
if (dragArea._x > yash._x+20){
yash._x = dragArea._x-(yash._x+100)
} else
if (dragArea._y < yash._y+20){
yash._y = dragArea._y+(yash._y-100)
}else
if (dragArea._y > yash._y+20){
yash._y = dragArea._y-(yash._y+100)
----------------random movement and dragable
onClipEvent (load) {
//data you may want to change
width = 550;
height = 400;
speed = Math.round(Math.random()*2)+1;
//initial positions
x = Math.random()*width;
y = Math.random()*height;
this._x = x;
this._y = y;
x_new = Math.random()*width;
y_new = Math.random()*height;
onClipEvent (enterFrame) {
//x movement
if (x_new>this._x) {
sign_x = 1;
} else {
sign_x = -1;
dx = Math.abs(x_new-this._x);
if ((dx>speed) || (dx <-speed)) {
this._x += sign_x*speed;
} else {
x_new = Math.random()*width;
//y movement
if (y_new>this._y) {
sign_y = 1;
} else {
sign_y = -1;
dy = Math.abs(y_new-this._y);
if ((dy>speed) || (dy <-speed)) {
this._y += sign_y*speed;
} else {
y_new = Math.random()*height;
onClipEvent(enterFrame){
if(drag){
_x = _parent._xmouse;
_y= _parent._ymouse;
The else part modified:
else
{ // not a corner point: keep handles in same relative position to their shifted anchor
var aShift = Math.random()*cShift;
var bShift = Math.random()*cShift;
thisPoint.anchor = [va + aShift, vb + bShift];
thisPoint.leftDirection = [la + aShift, lb + bShift];
thisPoint.rightDirection = [ra + aShift, rb + bShift];
Similar Messages
-
Been using LR since 2004. My raws are all of sudden jumping around in Develop module. Image does not stay, it goes forward and backwards randomly, even with magic mouse off. Can't edit. Using MacPro, currently everything. Canon 5dmk3 raws
This sounds like a hardware issue. I haven't seen this particular problem reported before.
-
When I try to upload a movie from I movie with the new iOS 7 it says sign in to YouTube when I do the screen goes back to where are started and it says to sign in again. Any suggestions?
Google seems to change their login security occasionally, and apps that assume it will work a particular way get left out in the cold till they are updated, since the login process is hard-coded into the app.
Here is the automated e-mail I received today from Google when tried to upload a movie using iMovie.
We recently blocked a sign-in attempt to your Google Account [REDACTED].
Sign in attempt details
REDACTED
If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activity to see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that you change it right away.
If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.
To learn more, see https://support.google.com/accounts/answer/6010255. -
Follow sprite when the mouse is down, but randomly move when mouse is up?
I have a sprite that has a Random Movement behavior.
While the mouse is down, I want it to stop this behavior and initialize a Follow Sprite behavior instead.
When the mouse is lifted, I want to stop the Follow Sprite behavior and reset/restart the Random Movement behavior.
Openspark helped me out with a different version of a very similar behavior a long while back, which worked. It switched between Random Movement and Draggable. I tried to edit the code so that it would apply to Follow Sprite instead of Draggable, but it isn't working the way I thought it would.
The order of behaviors on my sprite is as such:
followSprite (Follow Sprite)
moveToward (The behavior described above)
randomMove (Random Movement)
turnTowardsMouse (sprite faces mouse when it is clicked)
Face Destination (if not facing mouse, sprite faces toward the randomized endpoints generated by randomMove)
This is the moveToward behavior - the middleman that's supposed to be swapping between the two:
property pSprite
property pTouching
on beginSprite(me)
pSprite = sprite(me.spriteNum)
end beginSprite
on mouseDown(me)
-- Overrule the Random Movement and Rotation behavior until the mouse
-- is released. See the on prepareFrame() handler for the effect.
pTouching = TRUE
end mouseDown
on prepareFrame(me)
if pTouching then
-- Block the event from reaching the Random Movement and Rotation
-- behavior, so that only the Draggable behavior will work.
if the mouseDown then
stopEvent
else
-- The user has released the mouse.
-- Start a new movement in the Random Movement and Rotation behavior.
pSprite.pPath = VOID
sendSprite(pSprite, #mNewPath)
pSprite.pRotate = VOID
sendSprite(pSprite, #mNewRotation)
pTouching = 0
end if
end if
end prepareFrame
Can anyone help me figure this out?
If you want to imagine a visual, it's essentially a touchscreen fish tank. Fish swim around randomly, but when someone is touching the screen, they approach the point of contact (which is defined by a tiny invisible sprite centered on the cursor).
Once again, thank you so much to anyone who can help me out. This is part of a capstone undergraduate art project I am doing - and I am far more experienced in making the visuals than I am in coding. I am having to mostly tackle Lingo on my own. Any coding help I've received will be recognized (with permission) on my artist website as well as a thesis paper I am writing that will be published in May.As first steps at troubleshooting you could try an SMC reset and a PRAM reset:
SMC Reset
Shut down the computer.
Unplug the computer’s power cord and disconnect peripherals.
Press and hold the power button for 5 seconds.
Release the power button.
Attach the computers power cable.
Press the power button to turn on the computer.
Reset PRAM
Shut down the computer.
Locate the following keys on the keyboard: Command, Option, P and R.
You will need to hold these keys down simultaneously in step 4.
Turn on the computer.
Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
Hold the keys down until the computer restarts and you hear the startup sound for the second time.
Release the keys.
If that doesn't help, what OS are you running? Depending on the OS (Lion/Snow Leopard) will help determine the next step. -
Random movement within an irregularly constrained sprite (EDITED)
(NEW EDIT AT BOTTOM)
So, basically, I'm making a little program that crudely simulates an ant colony. I have little tunnels the ant-sprites can travel down, as well as chambers, in an irregularly-shaped sprite.
I am not the most advanced at Director, but at least I've figured some things out. I found code on an open-source website (openspark, actually) that allows for an object to be dragged inside an irregular shape that has a matte ink.
It's all well and good that the ants can be dragged within this boundary, but is there any way to have them use a Random Movement and Rotation behavior that is confined by the same laws? Or is that impossible / extremely hard?
By the way, I already have a middleman behavior I use to toggle between dragging and random movement, so that does not factor into my question. I just need to know how to alter the Random Movement behavior so that it abides by the same constraint rules as my dragging behavior, if possible.
Here is the code I'm using for dragging. I made a couple edits from the original, but not much.
Don't worry about the canJumpGaps function of this code, as I am using a touch screen and it will never be used.
property spriteNum
property canJumpGaps
-- set to TRUE on mouseDown if the shiftDown
property pSprite
-- this draggable sprite
property pConstraintSprite
-- sprite to which this sprite is constrained
property pConstraintAlpha
-- alpha channel image of constraining member
property pOffset
-- offset between this sprite's loc and the mouse
property pCurrentLoc
-- last known position of this draggable sprite with respect to the constraining sprite
-- EVENT HANDLERS --
on beginSprite(me)
pSprite = sprite(spriteNum)
pConstraintSprite = sprite(1)
-- We'll use the value of the alpha channel to detect holes in the sprite
pConstraintAlpha = pConstraintSprite.member.image.extractAlpha()
end beginSprite
on mouseDown(me)
canJumpGaps = the shiftDown
if not pCurrentLoc then
-- The user has not yet dragged the sprite anywhere. Find out its
-- current position with respect to the constraint sprite.
pCurrentLoc = pConstraintSprite.mapStageToMember(pSprite.loc)
if not pCurrentLoc then
-- The mouse is not over an opaque part of the constraint
-- sprite. It can't be dragged at all.
exit
end if
end if
-- Start dragging
pOffset = pSprite.loc - the mouseLoc
end mouseDown
on exitFrame(me)
if not pOffset then
-- The user is not dragging the sprite
exit
end if
if the mouseDown then
me.mMoveSprite()
else
-- The user just released the mouse
pOffset = 0
end if
end exitFrame
-- PRIVATE METHOD --
on mMoveSprite(me) ---------------------------------------------------
-- SENT BY exitFrame()
-- ACTION: Calculates how near to the current mouseLoc the draggable
-- sprite can be dragged.
tMouseLoc = the mouseLoc + pOffset
-- Find where the mouse is with respect to the constraint member
tImageLoc = pConstraintSprite.mapStageToMember(tMouseLoc)
if voidP(tImageLoc) then
-- The mouse is currently outside the constraint sprite. Use a
-- slower but more powerful method of determining the relative
-- position.
tLeft = pConstraintSprite.left
tTop = pConstraintSprite.top
tImageLoc = tMouseLoc-point(tLeft, tTop)
else if canJumpGaps then
-- Check if the mouse is over a non-white area of the constraint
-- member
tAlpha = pConstraintAlpha.getPixel(tImageLoc, #integer)
end if
if tAlpha then
-- Let the mouse move to this spot
else -- Can't jump gaps or the mouse is over a gap
-- Find how near the dragged sprite can get
tDelta = pCurrentLoc - tImageLoc
tDeltaH = tDelta.locH
tDeltaV = tDelta.locV
tSteps = max(abs(tDeltaH), abs(tDeltaV))
if not tSteps then
-- The mouse hasn't moved since the last exitFrame
exit
end if
tSteps = integer(tSteps)
if float(tSteps) <> 0 then
tStep = tDelta / float(tSteps)
-- This makes sure I'm not dividing by zero.
else
tStep = 1
end if
repeat while tSteps
-- Move one pixel towards the mouse
tSteps = tSteps - 1
tLoc = tImageLoc + (tStep * tSteps)
-- Test that we are still on an opaque area
tAlpha = pConstraintAlpha.getPixel(tLoc, #integer)
if not tAlpha then
-- We've gone a step too far: move back to an opaque area
tSteps = tSteps + 1
exit repeat
end if
end repeat
end if
-- Update the absolute and relative positions of the draggable
-- sprite.
tAdjust = tSteps * tStep
pCurrentLoc = tImageLoc + tAdjust -- relative to constrain sprite
tMouseLoc = tMouseLoc + tAdjust -- relative to the stage
-- Move the sprite
pSprite.loc = tMouseLoc
end mMoveSprite
Thank you SO incredibly much to anyone who can help. This is for a senior project of mine in undergrad, and I really appreciate any help I can get. My resources on Director are limited, especially for odd issues like this.
EDIT:
So I found out that a way to do collision detection in Director is by using getPixel().
I found this protected dcr file that is a perfect example of the way in which I want my ant objects to interact with walls:
http://xfiles.funnygarbage.com/~colinholgate/dcr/irregular.dcr
I've been trying to build a getPixel() collision detection mechanism for hours but have been unsuccessful.
Basically, what I want the behavior to do is... get the pixel color of the tunnel sprite (sprite 2) at the center of the ant sprite. If the pixel color is white (the transparent background color surrounding the tunnel shape), I want to tell the Random Movement and Direction behavior this:
pSprite.pPath = VOID
sendSprite(pSprite, #mNewPath)
pSprite.pRotate = VOID
sendSprite(pSprite, #mNewRotation)
This tells the Random Movement behavior to stop moving and determine a new path. The behavior should probably also offset the center of the sprite by a couple pixels when this happens so it is no longer over an opaque area and the Random Movement behavior won't get stuck.
Will this work? If not, could anyone help me in building a collision detection behavior based on getPixel? This doesn't seem like it'd be all that difficult - at least in theory.Hi Roberto,
I had an experience, which defies most common sense about data modeling. Moving from a cube to a ODS and then back on to a cube to introduce delta on a BPS delta application. It is a long sad disappointing store. But I had 24 keys (I know 16 is the max, I combined 6 keys into a single filed also had the same fileds in the data fileds, use these combination keys to deal with 16 key max limitation and adjusted during transformation.
It did work, but later gave up due to some other functional issues and we realized it is a bad experiement due to everyones data understanding.
I am saying is 16 key limitation is an issue, you can overcome with combining couple of fileds into a single filed in the start routine, map it and reuse it later.
Hope this gives you some ideas.
Goodluck,
Alex (Arthur Samson) -
Hey there.
I have a question about randomizing Movie Clips:
I am attaching an example where 12 movie clips will be called
into stage.
(movieA1, movieA2, movieA3....)
I am trying to create a situation where instead of triggering
"movieA1" and so on, the code will trigger:
movieA1 OR movieB1
movieA2 OR movieB2
movieA3 OR movieB3 and so on......
can anyone help here with how to apply it?
Thanks!
note that the attached code triggers AllMovies (MovieA's),
MovieB's are not in code yet, only in the library, because I am not
sure how to code such a thing.
adamlewenAll I posted was a replacement to the corresponding
attachMovie portion of your code... as you had in your first post.
If I've made a correct allowance for the wrapping it should be in
the 6th line of code beginning with
var Movie:MovieClip = _root["Movie"+i] =holder.attachMovie
etc
What I suggested is only making a change to the first
parameter to include a
B or no B in the library ID that's requested by the
holder.attachMovie part.
The way its set up (if you use this changed attachMovie) it
will randomise each time that makeAllMovies is called.
If I was doing something like this I'd be inclined to set up
the holder clips once. And then load the randomised content clips
inside on the setInterval call to something like your makeAllMovies
function. I also think you'd need to use removeMovieClip for
previously attached content clips before attaching each time as I
don't think it just replaces ("overwrites") the old one. I've seen
other posts where if you attachMovie the same library item with the
same name in the same holder clip, you end up with 2 instances
(flash apparently appends a number to one of them each time). If
this is indeed the situation and happened each time, it would
probably cause some problems.
Don't know if that helps. Kglad or others may have more
insight in this area where I've indicated uncertainty. -
When working mouse will randomly move even when I'm not moving it
When working on my computer my mouse will randomly move even when I'm not moving it. It is like I have a ghost mouse that is moving across the screen by itself. I checked and made sure screen sharing isn't on. It occurs randomly from what I can tell. It happened twice tonight where I'm on a window with my hand on the mouse and the cursor will move up to the top of the screen and then to the very left (which will turn on my screen saver). I will make me feel better if someone has seen this to. It happens very quickly and I can get control of my mouse. I have seen this off and on for a while. Anyone else?
I have the same issue.
It is a wired Mighty Mouse on a 24" iMac. My Macbook Pro with Wireless Mighty Mouse has never had an issue that I can recall, only the desktop.
It's pretty **** annoying to be fencing something in on Photoshop and suddenly your mouse is up in the corner of the screen and you've selected half your picture.
Anyone have any thoughts? What are the common denominators here?
As I said, 24" iMac running 10.5.5(although it has been happening since I purchased the computer somewhere around 10.5.3) Corded Mighty Mouse, Aluminum Keyboard. Can't think of any other relevant information.... -
Greetings,
I need a movie player which will play movies randomly. On a basic level, this is similar to the “Shuffle” function on iTunes. Or, in screensaver, where you can choose a folder containing still images to be played in random order, with a few parameters (like transition, fit to screen, etc).
The application for me is for a project I am working on made up of, eventually, hundreds of movies (of a particular place, event or person). These are HD (Apple ProRes) 1080p 24fps movies. They have no sound. They can all be grouped in one folder, say. I tell the movie player to play the movies continuously, in random order, from this folder, simple as that. They can be simple cut transitions, so there does not have to be any rendering, but the cuts must be smooth (ie, no jumps or black spaces inbetween).
Anybody know of anything like this out there?
Thanks ! Dave BerryYou might explore digital video disc jockey applications. I know of no way to tell any application like QT Player to pick random movies. That requires some scripting to generate a random number and to then use that number to select an item from a folder and then to push play and then to wait for the movie to end before running the script again.
But... You might open up the documentation for Automator and see if it can be done in QT Player. Someone may have already written a shuffle script.
bogiesan -
This problem only started after updating Firefox to 7.0.1--
When I'm browsing the internet, the tab I'm on will randomly move to a new window. It's very random and very annoying. Please help me to make it stop!
Thanks!Are you inadvertently using "tab tearing". If you drag a tab below the tabs bar and then release it it will create a new window moving the tab to it -- not a new feature. There is no animation or symbol attached to cursor -- at least not for me.
I put up with it and generally see it happen as tabs will widen, or my tabs counter will reduce.
bug489729 (Disable detach and tear off tab) :: Add-ons for Firefox
*https://addons.mozilla.orgfirefox/addon/bug489729-disable-detach-and-t/ -
When trying to sync a movie i just downloaded the snyc began and a few seconds in a received the error message "Attempting to copy to the disk "Ipod" failed. THe disk could not be read from or written to"
My first attempt was to try again, and the same error message appeared. I then went through the 5 r's and the problem still persisted.
Next i went on to the troubleshooting topic and went through those fixes and used them. The only one i could not get to work was repairing the disk drive, and because i'm a windows user i had to use the chkdsk command and it did not work properly, or i did not format it properly.
Anyway that still did not help and i went so far as to copy the movie file to a different folder, delete the original and then import it back in. Still the movie will not sync with the ipod. My best guess is the lack of USB 2.0 drives, in which case i would have to install a hub. But i would prefer another way out if possible. Any help would be appreciated
Dell Dimension 4300 Windows XP No 2.0 USB drivesHi
May be You mean this ?
Play all resp one chapter at a time
Play All Button
1. There are NO - Play All - button in any version of iDVD
2. It can be faked in several ways
• Easiest and most fault proof way is to make a doublet movie containing All and with
Chapters set to match. It will take up x2 space but is easy to understand and produce.
Cons: Tried this in iMovie’11 by Exporting out each part as a full Quality QT.mov then Importing back into new events and putting these into a new project (Play All project). Resulting DVD had Audio that was OK (as parts) - BUT the picture was very bad and standing photo were cut of in hight. So the Play All movie has to be created from same material and exactly in the same way as the individual parts + then Chapters has to be set to match.
• It's said that one can put all movies into a Photo/SlideShow and this will also
give the function of a Play All button - Tested - and ONE HAS TO un-cheque - Scale pictures to TV-Safe area else it will be a black frame all around and a small picture !
Mike Evangelist1
You might be able to get close to what you want by using a slideshow in iDVD. (It's not widely known, but you can put videos in a slideshow.) If you set the slide duration to manual, playback will pause after each movie/slide, and you can continue with the 'next' button.
3. Using another program to do this e.g.. Roxio Toast™ where there is a Play All button option.
Summary
a. Making a Play All movie with same care as the individual Part movies - gives a very Good Result
b. Using Roxio Toast™ - also an usable way to go
Yours Bengt W -
I made a 3-minute movie with my iphone 4S. When I attempt to share it via email or message I get a message that says it is too long, that I should try to make a clip. Of course I had rather send the whole thing. What are the possibilities? I think my music and likely my videos and pictures are in the cloud.
SadisticIron wrote:
i just baught my first iphone and it is a jalbroken
Buzz! Thank you for playing!
Discussing jailbroken devices is forbidden here by the Terms of Service.
You can not get help here. -
home sharing is turned on in my pc but apple tv does not show my entire movie library.
please helpWhere are you trying to access them? Make sure you are going to the Computers icon. Also make sure to check under Movies and Home Movies.
Make sure they are all compatible.
H.264 video up to 1080p, 30 frames per second, High or Main Profile level 4.0 or lower, Baseline profile level 3.0 or lower with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4 and .mov file formats
MPEG-4 video up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4 and .mov file formats
Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format -
How do i connect my iMac to my tv to see movies with wire
how do i connect my iMac to my tv to see movies with wire
Hey rodskc10,
Thanks for the question! Based on the iMac model and TV you have, you’ll need to pick up a compatible cable. There are a few options that can be found on the Apple Online Store:
Mac Cables - Computer Audio & Video Adapters, Network Cables & More - Apple Store (U.S.)
http://store.apple.com/us/mac/mac-accessories/cables#!
For example, if you have the latest iMac and an HDTV, a mini DisplayPort to HDMI cable should do the job (you’ll connect this to the Thunderbolt port, which is backwards compatible with mini DisplayPort).
For additional information, see this article:
OS X Mavericks: Use a television as a display
http://support.apple.com/kb/PH13801
Thanks,
Matt M. -
When streaming a movie with the new Apple TV, and using a DSL Internet connection, all audio sound works, e.g., the music track, but the audio track with the actor's voices, does not work. What can I do?
Hi Brian,
Thanks restoring and restarting didn't fix my problem - i have started it fresh and still it doesn't work. Basically I press ONCE on the remote, after the machine has not had any commands for 10 minutes, and the cursor skips from one end of the menu to the other - so I can't choose network or update software etc - I sometimes manage to stop it randomly in the middle of the menu if I press on a command in the middle of the cursor skipping all the menu steps...not sure what the problem is but I have basically not used my brand new apple tv since I bought it for that reason! I should call Apple support I suppose! grrrr hate wasting time with stuff like this!
Thanks for your help though!
Pernille -
Can nolonger watch YouTube movies with my new Safari 2.0.4
I recently went from an eMac with 10.3.9 - Jaguar, to an iMac with 10.4.8 Tiger. My Safari is 2.0.4.
While I was able to watch all YouTube movies, I can nolonger do so. The movie stops about 5 seconds after watching a movie. It behaves as though I already watched the movie.
I did a search to see if I could find similar incidents, and I can see that others may have experienced this problem, but no resolution was ever made.
I run the disk utility almost daily, so there are no permissions that need repairing. I use Foxfire to watch the YouTube movies with no problem, so it appears to be a Safari thing. Not really a 'Safari' thing, more than a Safari 2.0.4 thing - at least it seems that way.
Any help or advice would be appreciated. Thanks.Yes... that's what I meant! Actually, I cut and pasted that info, so I cut and pasted the wrong info!
EIther way, it did answer my question, so I will mark it as such.
I think that if the others who had the same problem who posted before me will be able to solve their problem as well.
Maybe you are looking for
-
Deleting a partner application via ssoreg.sh
Has anyone tried deleting any patner application registered in SSO via ssoreg.sh. As per syntax these are the values: $ORACLE_HOME/sso/bin/ssoreg.sh -oracle_home_path orcl_home_path -site_name site_name -config_mod_osso TRUE -mod_osso_url mod_osso_ur
-
How to find out the manditary fields in an IDOC
Hi, How to find out the manditary fields in an IDOC. For example MATMAS05 . For this 2 segments I want to find out the manditary fields. E1MARA E1MAKTM
-
Hi Guys, I have an issue with F110 payment to vendors, system have done payments to vendor and created an list of payment where the issue is for same vendor we have two payments fo which its created two different documents of clearing and showing the
-
Why can´t i use face time call with on my ipod touch with ios6
Why can´t i use face time call with on my ipod touch with ios6
-
Mapping Objects in Flex Data Services
Hi My Dear Friends This is yogans, i am working in flex for the last 15 days and i learned the basic things like syntax, tags, scripts. and i am doing some data services work now. especially with the help of Java Remote objects. I dont know http serv