ActionScript 2.0 :: Back To Basics - Tracking Mouse Coords Into An Array

Mar 9, 2004

I've been reading through all the various threads related to the drawing API and saving drawings. About a hundred times I've seen mention of "log mouse positions into an array" and stuff like that, but I can't find any clear and simple examples of how to do this.

Let's take a very simple use of the drawing object to do freeform drawing. What is the AS to capture the mouse XYs as the user draws and put that into an array. I can't figure out how to get Flash to keep updating things as I go, it invariably grabs the fist point and that's it. Could one of you AS gods just write out a super simple routine for this? I know I'm not the only one that needs this (as it seems to be asked every week) Let's use the most basic drawing example I can find:

[Code]...

View 14 Replies


Similar Posts:


Get 3D Coords On Some Plane For 2D Mouse Coords In Flash With Away3D?

Aug 1, 2011

Waht is the right way to get 3D coords from 2D mouse coords using Away3D. (version 3.6.0) It's ambigoius problem in general, so there is restriction that 3D point belongs to some fixed plane.

There are some examples with camera.unproject and plane.getIntersectionLineNumbers methods, but they don't work if camera is rotated or plane is not trivial.

View 1 Replies

ActionScript 2.0 :: Tracking Mouse Coordinates Into Array

Mar 9, 2004

I've been reading through all the various threads related to the drawing API and saving drawings. About a hundred times I've seen mention of "log mouse positions into an array" and stuff like that, but I can't find any clear and simple examples of how to do this. Let's take a very simple use of the drawing object to do freeform drawing. What is the AS to capture the mouse XYs as the user draws and put that into an array. I can't figure out how to get Flash to keep updating things as I go, it invariably grabs the fist point and that's it.

Let's use the most basic drawing example I can find:
[AS]_root.createEmptyMovieClip("line",1);
_root.onMouseDown = function(){
line.moveTo(_xmouse,_ymouse);
line.lineStyle(0,0x000000,100);
this.onEnterFrame = function(){
line.lineTo(_xmouse,_ymouse);
}}
_root.onMouseUp = function(){
this.onEnterFrame = null;
}[/AS]

Where/what gets added to just capture all those _xmouse and _ymouse?

View 14 Replies

ActionScript 2.0 :: MovieClip Cannot Get Back To Coords It Was Before

Feb 25, 2005

If you check my site I'm trying to make [URL] and click one of my buttons the menu/logo/music/.. will move to the coords..

Here's the script I used:
1st frame:
speed = 5;
Frame in which the action will take place:
MovieClip.prototype.move = function() {
[Code] ....

But if you try to click for example on the "contact" button and after "about" button you can see that my music button (right side) is closer to the main border... so why the mc's coords are little off if you had clicked different button before (or if the mc's coords are different than before)? [note that I need to use Math.floor and Math.round to make it look sharp and that the speed value is for all MC's number 5]. Also my MC location is set up to hole pixels..

View 14 Replies

ActionScript 2.0 :: Mc To Zoom To Mouse X&y Coords

Jul 12, 2007

I have an mc that when I press a key it will either zoom in or out. Right now it zooms in/out, but it does with with the up-left corner as the point to zoom from. Can anyone direct me on how to zoom in/out where ever the mouse is relative to the mc? If the mouse is in the middle, then it zooms from the middle and so on.

View 5 Replies

Flex :: Cannot Use Mouse Tracking

Dec 7, 2010

Trying to create a banner ad as a one-off project for a client. I am using Flash Builder / AS 3 and with my simple hello world example. Google Adwords rejects the add with: Encountered flash error - ad cannot use mouse tracking.

I Have not been able to figure out what I am doing that signals to Adwords that I am mouse tracking. Follows is my simple mxml file: (the handleClick is to adhear to their clickTAG specification)[code]...

View 1 Replies

ActionScript 2.0 :: Navigation That Uses Mouse-tracking?

Aug 28, 2009

I am constructing a navigation that uses mouse-tracking. I'd like for the object (the gray rectangle) to disappear when the mouse moves off of it.

I have the following actionscript on the movie clip:

onClipEvent (enterFrame) {
_root.xChange = Math.round(_root._xmouse-this._x);
_root.xMove = Math.round(_root.xChange/5);
this._x += _root.xMove;
}

If you look at my reference, I'd like the gray arrowed-rectangle to only appear when the mouse is inside the lighter gray rectangle (the navigation bar). When a user mouses outside of that area, the gray arrowed-rectangle will disappear.Perhaps we have to set an area where the mouse will load the movie clip and an area that will unload the movie clip?

View 0 Replies

Actionscript 3 :: Move Movieclip Position Opposite Of Mouse Coords On Other Movieclip

Jan 26, 2011

Okay I have a script in which I have added an image to the stage. It is absolute centered. I then have another with is on top but much bigger. I would like the big image to move opposite of my mouse position on the smaller image. ie: cursor is on bottom left corner the bottom left corner of the larger image is in the same spot. And the same thing for any other area.

I have tried many different ways but to no avail. I have done research but no one has been able to give me a solid answer. Anyone know of a way to accomplish this. Keep in mind this it needs to work regardless of the image size.

View 1 Replies

Flash8 :: Mouse Tracking Update From Flash 6 To 7?

Apr 28, 2009

how to update this action script from flash 6 to flash 7.Its for a scrolling line of pictures.

mouseh = getProperty("/tracker", _x);
mousev = getProperty("/tracker", _y);
if (Number(mousev)>0 and Number(mousev)<552) {[code]..............

View 1 Replies

ActionScript 3.0 :: 3D Text Effect Mouse Tracking Script

Dec 15, 2011

Can you pliz help me with a script to make this effect? the 3D text effect that follows with the mouse.URL...i got a script that tracks the mouse till the end of the screen but i needed something like this that only tracks it slightly. i'm only a beginner in flash.

View 6 Replies

ActionScript 3.0 :: Square MovieClip - Tracking Coordination Of Mouse Click

Oct 20, 2010

I have a square movieclip named squarepad. What I want is when I click on it to do [some stuff] according to where the square is clicked. It should be something like this:
if ([mouseclickedx] > 1) and ([mmouseclickedx] < 10) then
[do this]
end if

View 1 Replies

ActionScript 2.0 :: Tracking A Values Position In An Array?

Feb 23, 2010

So I've got a button that spawns a block and when pressed spawns another to the right of that block, if pressed again the process repeats. These blocks are all placed into an Array. When the user click on the blocks, they are removed.I would like the blocks to track their position in the Array so I can splice out the value on click and all the other "building spots" will move to their Array position * building spot width, so when a block is cut out, the others all move a long and remove that space.Since Arrays aren't my strong point, I wish to see what you think would be the best option here. Now keep in mind I am not a Flash Pro, so the way I have coded may not be the best, but I like to think I try Here is the code currently:

ActionScript Code:
onClipEvent(load){
}

[code]......

View 5 Replies

ActionScript 2.0 :: Tracking Array Index Of An Instance?

Sep 9, 2011

I'm trying to keep track of several movie clips with an array, but I'm running into some issues. I'm making a shooter game that requires hitTesting a list of projectiles and removing the projectiles from the list when they leave the screen or hit stuff. I've got the projectiles being added to the stage with this:

[Code]...

At first that appeared to work fine, but the bullets aren't always removed in the order they were created, so when I remove one from the array in this manner, it shifts the index numbers for all the ones that came after it back one, thus making their "num" variable no longer correspond to their index number; so when they try to splice themselves, they end up splicing the wrong ones. (Like, if I removed [3], the bullet that was in [4] is now in [3], but it doesn't know that, so it tries to splice [4], which now refers to whatever was in [5], and so on.) What's the correct way to handle this kind of situation? I feel like I must be missing something obvious, but I haven't been able to figure out a solution.

View 2 Replies

ActionScript 2.0 :: Load Swfs From Array Back-to-back?

May 28, 2010

I am working on a having external swfs get loaded into the main swf one by one from an array.I can get the first one to load, but it just keeps on playing the first item in the array over and over, instead of loading the next movie. I have a container on my stage, cleverly named "container" and I am using AS2 and loadMovie.

I am guessing my conditon on my if statement is off, but I am not sure how to tell the onEnterFrame to check the currentframe of the loaded swf and not the container itself. I might be way off, but in my mind I feel like this mostly makes sense, but knowing Flash it is probably not nearly enough coding.I might also add this won't be running on the web, so I don't need to worry about preloading swfs since it will be running directly off a PC onto a screen in our office.Here is my code:

Code:
var myClips:Array = ["movie1.swf", "movie2.swf", "movie3.swf", "white_logo.swf"];
var i:Number = 0;
_root.container.onEnterFrame = function() {[code].....

View 2 Replies

Actionscript 3.0 :: Tracking Right/wrong In An Array Of MovieClips/Objects?

Jan 18, 2009

I've got two rather large arrays which I put a bunch of movieclips into and I'm just stumped on how I can possibly track if a specific movieclip in the array is right or wrong. Determing right/wrong is something I need to be able to set and then check again later when a function getItem is called.

Code: Select allvar mcArray:Array = new Array();
mcArray = [movieClip01, movieClip02, movieClip03];
button.addEventListener(MouseEvent.CLICK, getItem);

[code]...

View 4 Replies

Actionscript 3.0 :: Tracking Right/wrong In An Array Of MovieClips/Objects

May 27, 2009

I've got two rather large arrays which I put a bunch of movieclips into and I'm just stumped on how I can possibly track if a specific movieclip in the array is right or wrong. Determing right/wrong is something I need to be able to set and then check again later when a function getItem is called.

I just quickly made this example code because the actual file's code is much longer and contains a bunch of other code that is irrelevant to this issue.

Code: Select allvar mcArray:Array = new Array();
mcArray = [movieClip01, movieClip02, movieClip03];
button.addEventListener(MouseEvent.CLICK, getItem);
function getItem(e:MouseEvent):void {

[Code].....

View 1 Replies

Flash :: Javascript - Tracking Mouse Position After Click-and-drag (down-and-move), Even Outside The Stage / Browser?

Feb 17, 2011

What's the correct way to track mouse position, from Adobe Flash, when someone has: Started a drag within the Flash application (a MOUSE_DOWN event), Dragged the mouse outside the app or even the browser window (a MOUSE_MOVE event), and Released the mouse button (a MOUSE_UP event)? For example (imagine Stack Overflow is a Flash application):

Within the app, I'm able to track the mouse X and Y positions with a MOUSE_MOVE event listener, but I lose it when it goes outside of the browser... So, how do I track the position of the mouse no matter where it goes? For a good example, try Google Finance. Try dragging the chart around; it'll still drag around if you move your mouse out of the browser window, and the mouse will be outside of the browser when you release it.

Also, check out KOKO KAKA; If you click on the scrollbar (make the browser window really small) and move outside of the browser window, the scroll bar moves just like a real one would. I believe both only work because the MOUSE_DOWN event "captures" the mouse, allowing the Flash application to track the position of the mouse even when it is outside of the browser.

View 2 Replies

Professional :: Make Buttons That Animate On Mouse Over Go Back To Original State *smoothly* On Mouse Off?

Aug 26, 2011

The title pretty much sums up what I am trying to do: I haven't started digging into using script in Flash yet, still being very much a beginner.
 
I created a simple file using movie clips nested in buttons so that when I mouseover a letter, it bobs up and down, but I can't work out how to make it return to its original "up" state *smoothly* when the mouse is moved away. If it must involve script please be aware I am a total noob!

View 9 Replies

ActionScript 3.0 :: Cloning Array - Get Back An Object Rather The Exact Duplicate Of The Array Itself

Jul 7, 2010

I have been trying for an hour to clone an array, It seems that nobody has a true reference on how to do it. Two arrays - movieClipArray 1 and movieClipArray2 I want to duplicate movieClipArray1 entirely so that when I addChild(movieClipArray2[0]), it doesn't take away from movieClipArray1 or reference it in any way.

[Code]...

View 3 Replies

ActionScript 3.0 :: Mouse Hovering - When The User Moves Mouse Down, More Text Appears From The Bottom And When Moves It Goes Back To The Original Position?

Apr 21, 2010

I have MC masked with TEXT,when the user moves his mouse down more text appears from the bottom and when he moves it goes bakc to the original position...I do not want the mouse wheel .. I woudl like to do it by mouse hovering...

View 5 Replies

Flex :: Basics In For Loop In Actionscript 3 ?

Mar 23, 2011

this is my sample code

var i:Number = new Number();
trace("showarray length" + showArray.length);
for(i=0;i<showArray.length;i++){[code].....

wherenever the if is satisfied it stops looping it immediately goes out of the loop.this is a sample output given that the length of showArray is 2 and num = 0

showarray length2

equal daw0==0

alerts

View 5 Replies

ActionScript 3.0 :: Down To The Basics Button 2 Next Frame?

Jan 19, 2011

I'm trying to make flash animations w/ text. I don't know how to make buttons though so I can advance the movie. I really have NO idea so I need details on EVERYTHING past opening up a new as3 document.

View 3 Replies

ActionScript 2.0 :: Object Basics By Senocular?

Jul 27, 2004

I am only at the very beginning and I want to make certain that I go through this understanding everything that can so maybe I won't have to ask as many questions in the forums and can start answering more. In this part:The code for making a standard generic object in Flash is as follows:

myObject = new Object();

The variable myObject then becomes a object variable which can then have more variables added to it using dot syntax like so.Is myObject the actual name of the variable and the = new Object simply stating that there is a new object called myObject?

View 14 Replies

ActionScript 3.0 :: Understanding Basics Of Random Motion

Apr 15, 2011

I started out learning AS3 on my own a while ago without any programming experience whatsoever. I'm still in my diapers, but slowly progressing. Currently I'm working on a short animation with some code involved. Part of the animation is a herd of cows grazing in a pasture. I have a class called Cow which extends MovieClip and on the Cow timeline I have the walk cycle and other cow movements animated. When a cow is walking it slowly moves horizontally, along the x axis. I want the cows, when walking to also randomly move up and down (along the y axis) which would basically look as though the cow is moving further away or moving closer towards us. I'll be resizing each cow, according to its y position to create the effect of perspective (near and far).

What I'm trying to figure out is how to make the cow move either up or down the y axis in a somewhat random way. By "somewhat random" I mean that I don't want the cow to switch directions every second, but rather something like: 5 seconds moving up the y axis, then maybe 8 seconds moving down, then possibly 4 up, then 11 down, etc. It would be super if I could also have a velocity factor involved, meaning that when changing directions - from up to down, or down to up - I prefer that the change is smooth, like as in a ease out and then ease in.

[Code]...

View 2 Replies

Actionscript 3 :: Flex/Flash Builder Basics?

Mar 27, 2011

I've been trying out Flash Builder for the first time and I can't seem to get it working...

First off I have these bits of very basic code:

[Code]...

Another key problem: Flash Builder cannot connect to the debugger, even though I've installed it twice now.Can anyone help me here? I've made sure my firewall is off, but could this be causing problems?

View 2 Replies

ActionScript 2.0 :: Basics Of Calling A Function With A Variable?

May 27, 2011

I'm trying to get to grips with having a function that can accept an input that is passed to it as it is called, and then use that input in its workings.As I'm writing more code, it's becoming clear that this is something that I need to pick up, but despite reading and playing about with it, I'm still a little confused.The code is designed for a character's "level up" screen. When the button next to a stat is pressed, I want it to pass the name of that stat to the statUp function, which will increase the selected stat by one.In my main file I have this code, to call the function when the button is pressed. (In this example, it is the Strength button)

ActionScript Code:
_root.buttonStr.onPress = function()
{

[code]........

View 6 Replies

ActionScript 2.0 :: Back To The Original When The Mouse Rolled Out?

Jan 6, 2005

I was trying to create a button rollover that, when the mouse was over a button, a movie clip would advance frames, and go back to the original when the mouse rolled out. The AS I used was just the basic button rollover, attached to the button itself

[Code]...

But, even if the command is gotoAndPlay, the clip will advance and show objects that are not symbols(if they are symbols, it shows the last frame of the symbol), or objects that have been motion tweened.

Two questions out of all of this. First, is there a better way to do a button rollover? And secondly, is there a way to get movie clips/motion tweened objects to show up in a movie clip that is dependent on a rollover?

View 4 Replies

ActionScript 3.0 :: The Uber-basics: Communicating Between The Stage And The AS File

Mar 17, 2009

I was pretty good at 2.0 but 3.0 has completely lost me. I've been reading up on it and getting a handle on it, but in the entire Actionscript 3 BIBLE I have not been able to figure out the simplest, key part that links it all together. How, in the name of everything that's holy, do I communicate between the stage and the "ever-necessary, more secure, more robust" AS files I'm creating? I wish I could give specific code, but I'm just looking for the guideline. If I create a function in a class, I can't call it in the timeline or a button, or even a line down from it in the AS file (call to possibly undefined method).

If I create a sprite in my AS file and then try to add it to the stage, addChild is an undefined method or function. If I create a movie clip in flash, export it for actionscript, it's undefined in my AS file. Just show me how I can write a super simple program where the thing on the STAGE interacts with the thing in the AS file, and I can take it from there.

View 9 Replies

Actionscript 3.0 :: 3 XML Basics - SelectedItem On ROLL_OVER - Error #1009?

Mar 17, 2008

Is there a way to modify this tutorial to execute selectedItem on ROLL_OVER instead of click? I changed

lb.addEventListener(Event.CHANGE,itemChange);

to

lb.addEventListener(MouseEvent.ROLL_OVER, itemChange);

but when I rollover a list item I get: TypeError: Error #1009: Cannot access a property or method of a null object reference. at as3xml_finished_fla::MainTimeline/itemChange()

View 5 Replies

Actionscript 3.0 :: Basics Of Papervision3d Tut Code As A Separate As File?

Feb 17, 2009

I've just been following the Basics of Papervision3D tut, which is very good by the way, the only one I've ever managed to get working.And I'd like to write the code as a separate as file, but I'm having a bit of trouble.In the class definition, what should it extend?[code]I tried everything I can think of and looked at other tuts to see what they've done but nothing works.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved