ActionScript 2.0 :: Scale A Beam To Mouse Co-ordinates/point?
Oct 23, 2008
I have attempted to make a movieclip scale in the y axis using _yscale but I can't seem to make it scale to the exact mouse co-ordinates.
Its within a rotating movie clip (controlled by the position of the mouse) and that works fine.
Here's the code I'm using at the moment.
Code:
onClipEvent(enterFrame){
var disty = this._y - this._ymouse
var dist = Math.sqrt(disty*disty)
this._xscale = 100 + dist;
}
View 6 Replies
Similar Posts:
Jun 14, 2010
There is an Image control that when I click on it I need to zoom in (using the center/transform point where the mouse is clicked). I have the zoom transition working great, but when I set transformX & tranformY (with autoCenterTransform false) it doesn't zoom into that point.
Here is my code that only zooms in (not to a specific point)
<fx:Script>
<![CDATA[
protected function imgLogo_clickHandler(event:MouseEvent):void {
transformer.play();
} ]]>
[Code] .....
View 1 Replies
May 11, 2009
I want to make an editor like this site. [URL] If you browse this link you will find "Button. If you press this button you will navigate to a editor to design your layout. After draw a rectangle or circle or line you can resize that or can rotate that. When you finish if press the "you will back to the previous page where your desinged layout display. If you press the "" again then you will navigate the editor with the previously designed layout. I want to make a site like this. I want to use the flash cs4 to make the editor. Anybody knows how to draw a rectangle or circle shape with mouse and how to scale by setting the point and how to rotate by setting the rotation point also by using flash cs4 and as3?.
View 3 Replies
Dec 29, 2008
How to access x and y co-ordinates when a mouse's left button is clicked upon a JPG file whichis placed on a stage, so that we can view the jpeg contents on the stage?
View 7 Replies
Nov 3, 2003
From the Robert Penner code given in this tutorial: [URL] i was wondering why controlx and controly has to be so complicated. I've tried changing it to just _root._xmouse but it messes up. I don't get this, shouldn't the curve point be the same point as the mouse?
View 13 Replies
Jul 2, 2011
I've searched but haven't found anyone wanting to do this with a bitmapData object.I'm using the following code:
matrix.identity();
matrix.translate(pan.x, pan.y);
matrix.translate(-zoomPoint.x, -zoomPoint.y);[code].....
Panning works, but using this method scale does not scale around my mouse.Has anyone done this successfully?
View 2 Replies
Jun 19, 2011
I have a point which is 3,5 I want to scale, or multiply this point, by a factor of 5. To give me 15,25 What I'd really like to be able to do is: mypoint *= 5; but that doesn't work. I can't find any suitable method in the point class either. So what I'm trying to do now, which all research indicates should work, is:
[Code]....
View 3 Replies
Sep 8, 2011
basically just wondering if its possible to scale an MC about the center of the stage as opposed to the top left of the MC? I thought about setting the X & Y as stage width / 2 + MC width / 2 but cant as the user needs to be able to move the MC which is much bigger than the stage and zoom in on a point in the center rather than just the center of the MC.
View 2 Replies
Oct 27, 2011
I've created an mc which functions as my map and controls to go with that which allow the map to be moved around and key points navigated to and zoomed in on at varying zoom levels.I'm using scaleX and scaleY to scale the map mc and a list of x and y positions to correctly position the map for each key point.When I want to go to a certain area I perform this calculation (offsetX and offsetY are the center of the screen):
newX = posX * scale + offsetX;
newY = posY * scale + offsetY;
Then I tween the position and scale of the map to smoothly scale and move the map to the correct position:
var tween = new TweenLite(_background, EASING_SPEED, {x:newX, y:newY,scaleX:scale.getScale(),scaleY:scale,ease:EASING_TYPE,onComplete:moveToComplete,onCompleteParams:[room]});
I now need to implement a zoom in / out function and this is what I'm struggling with. The zoom should use the center of the screen as the reg point for the scale, so I've been trying something along the lines of the following to get the correct positioning:
var newX = offsetX - (offsetX - _background.x) * scale;
var newY = offsetY - (offsetY - _background.y) * scale;
So in my mind this gets the distance from the current position of the map relative to the center point of the screen (offsetX, offsetY) then scales that distance by the new scale. However, this is clearly wrong because it's not working and the positioning of the map is wrong.I've also tried using a transform matrix to get the correct values but I know even less about them and not got the right results.
function scale(target:MovieClip, center:Point, scale:Number):Point {
var m:Matrix = new Matrix();
m.translate(-center.x, -center.y);//move the center into (0,0)
[code]....
View 3 Replies
Dec 1, 2010
I'm trying to add some zooming functionality. The problem is that when you zoom in and out, it scales the MC up and down from where the registration point is. This means That when I'm far from the position of the registration point instead of zooming the in straight it also makes it appear as if you are travelling towards the registration point.
To offset this effect I want to calculate the amount of pixels I need to offset the Map by so that it appears as if you are zooming in directly.
So just as a test I've put a little ball inside the map(called "center") which I'm trying to keep in the center of the map.[code]...
View 1 Replies
Nov 9, 2009
I have developed a flash app in AS3 that allows you to drag objects around on stage, save,and load them. When the "save" button is pressed, it then loops through each item on the stage and gets the coordinates (x and y) for the bottom left corner and the top right corner. Code:
Code:
ActionScript Code:
var bottomLeft:Point = new Point(-50, -50);
[code]........
View 3 Replies
Feb 16, 2010
I'm trying to make a text effect where on every frame the textfield increases in size and decreases in opacity. I'm using the scaleX and scaleY properties of my dynamic textfield to enlarge, but it's doing so keeping the left registration point fixed. I want to make it scale up radially outward, or with the center point fixed.
View 4 Replies
Oct 3, 2009
1. Is there a way to scale up an object from its center even if its registeration point is at the top left? can that be done using TweenMax?2. can I apply the same tween on two objects at the same time? basically what I want to do is load up an image to the stage, and then tween its scale from 0 to the original size along with another movie clip behind it that would form some sort of a border for the image. and I want to scale them up from the center.
View 5 Replies
Jul 31, 2009
When you load a object through flash, you can set the rotational/scale point, but when you load it as a loader object or sprite, how do you change this point?
In this instance, I want to change the height of a sprite that is filled with a rectangle so that it shrinks down, not up.
Right now:
var colored_bar:Sprite = new Sprite();
with (colored_bar.graphics) {
beginFill(0x9e1819, 1);
[Code]....
The way I am doing it currently is moving the y position everytime I take away soem of the height, so it looks like it's moving down, but I'd think moving the orientation point at the beginning would be faster
View 2 Replies
Dec 3, 2011
Whenever I test a movie or view in html browser, the text is unlightable/selectable. How can I make it so that I can highlight the text and copy/past. You know the options when you right click after highlighting text.
View 3 Replies
Jun 26, 2004
Realistic FLASH spotlight beam, not using a circular mask. I am in desperate need of some information, about realistic spotlights designed with flash. I need the kind that shoot a beam with a round circle on the floor. I have found a great example, at http://www.grisu.com and the owner even shared the fla code with me, but I still don't quite understand how to modify it to work for me. He offered to help, but he only speaks spanish and I only speak English, so we can't communicate.
If you go to his web and view the stage, the beam sweeps the stage and changes the angle and size of the beam. I need a longer and narrower beam. The length of the beam is too short for me, but the idea is just what I need. Does anyone know of any tutorials on this subject? Or possibly other samples so that I may study them in detail.
1. Is a mask necessary to keep all the beams the same length as they scan? As the angle changes, the beam length would change unless a mask or something cuts them off at the floor level always.
2. Motion tween could probably be used to move the beam?
3. Would it be necessary to skew the beam as it sweeps as when it is slanted like that, the width of the beam gets wider as it sweeps away from you and more narrow as it sweeps closer to you.
4. Did you need to use alpha anywhere possobly when the beams cross each other or maybe when it is first turned on?
I would greatly appreciate any advice anyone can give, or steer me in the correct direction for some tutorial information.
View 12 Replies
Jun 26, 2004
Realistic FLASH spotlight beam, not using a circular mask.I am in desperate need of some information, about realistic spotlights designed with flash. I need the kind that shoot a beam with a round circle on the floor. I have found a great example, at r even shared the fla code with me, but I still don't quite understand how to modify it to work for me. He offered to but he only speaks spanish and I only speak English, so we can't communicate. If you go to his web and view the stage, the beam sweeps the stage and changes the angle and size of the beam. I need a longer and narrower beam. The length of the beam is too short for me, but the idea is just what I need.
Does anyone know of any tutorials on this subject? Or possibly other samples so that I may study them in detail. 1. Is a mask necessary to keep all the beams the same length as they scan? As the angle changes, the beam length would change unless a mask or something cuts them off at the floor level always. 2. Motion tween could probably be used to move the beam? 3. Would it be necessary to skew the beam as it sweeps as when it is slanted like that, the width of the beam gets wider as it sweeps away from you and more narrow as it sweeps closer to you. 4. Did you need to use alpha anywhere possobly when the beams cross each other or maybe when it is first turned on?
View 12 Replies
Jan 4, 2010
Is there a way to increase a movieclips scale as you hold down mouse_down?At the moment my movieclip only increases scale on mouse down on the extact center x & y point of the movieclip. I need it for userbility reasons to increase in scale when the user clicks on any area which is the movieclip.
ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
function onStartDrag(evt:MouseEvent):void {
[code]....
View 2 Replies
Mar 26, 2008
I have a problem with a button i want to create. I want different buttons (simple circles) that become bigger and 100% visible when the mouse becomes closer (at a certain distance), visa versa. till 0% visibility
Searched on forumI found this couldn't find anything helpful. I found the code here below, but i don't fully understand it to change the code. I tried changing it in many (probably very bad) way's, as result that it only got worser... :(
Frame 1:
Code:
//this objects x position
posx = this._x;
//reaction boundaries
[Code]....
View 2 Replies
Jan 23, 2010
How might I go about making a sprite scale by dragging on it with the mouse? All my attempts so far have led to unexpected scaling effects...
View 1 Replies
Oct 2, 2011
when the mouse is idle, dynamically create a circle and scale . the scaling has to depend on the mouse idle time.. so here i couldn't scale the circle, but all other are done. am put the code here.
CODE.................
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.motion.Tweenables;
[Code].....
View 5 Replies
Feb 7, 2007
I would like to scale a movie clip based on how close the mouse gets to it, but flash slows when there are a ton of these. I'm looking for a new method
onMouseMove = function(){
var dx:Number = this._x - _parent._xmouse;
var dy:Number = this._y - _parent._ymouse;
[Code].....
View 1 Replies
Oct 27, 2007
I'm trying to get the same effect as this page[url]...
View 9 Replies
Aug 5, 2010
I am basically trying to create a display object transformation manager which will allow me to scale/rotate objects. I am currently trying to figure out how to rotate an object so its corner follows the current x and y of the mouse. I always get confused on the math of things like this. I know how to listen for the events and everything, I just am unsure of how to calculate the amount of rotation to apply. I will probably be rotating via a Matrix so I can rotate the object around its center, rather than the upper-left corner of it. My question here is: how do I get values when I don't want them constrained, like scaleX and scaleY?
View 1 Replies
Feb 1, 2010
I'm trying to make a zoom in and out effect, on images in a movieclip, using the mouse wheel. But, there is another mouse event that scrolls through the frames of the movie clip. I need it to stay zoomed in, and out respectively, when you scroll to the next frame.
View 0 Replies
May 17, 2009
I made this Code to scale the movie when mouse is over and turn it to the normal size when mouse out, I got this error and i don't understand it (TypeError: Error #1034: Type Coercion failed: cannot convert "mc1" to flash.display.MovieClip. at Scaling_fla::MainTimeline/DoMe()TypeError: Error #1034: Type Coercion failed: cannot convert "mc1" to flash.display.MovieClip. at Scaling_fla::MainTimeline/reDoMe()
[Code]...
View 7 Replies
Aug 28, 2009
i was trying to mess around with flash and I was hoping I would use TweenMax to scale up a rectangle (instantiated as rect) on mouse over, and then once it is scaled up I wanted to load an swf file to its center (the swf is called CircularPreloader.swf which is a fake preloader, just for messing around porpuse). Well, I tried but it didn't work cuz I kept getting this
error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at scaleUp_fla::MainTimeline/frame1()
Here's the code:
import gs.*;
import gs.easing.*;
[code]....
View 12 Replies
Apr 6, 2009
This is a fairly simple problem, yet I can't make it work. I have an arrow-shaped mc, and I want it to rotate, constantly, so it points at the mouse.
this is what i do every frame:vectorArrow.rotation = Math2.radsToDegs(Math.atan(-(root.mouseY - y)/ (root.mouseX - x) ) );
what happens is that it rotates strangely. It doesnt rotate fully, let alone point to the mouse. I've also tried someone elses code:
[Code]...
View 2 Replies
Jun 8, 2009
I am trying to have a flashlight follow the mouse from it's pivot point. Rotating from its registration point, 180 degree rotation. Also have it move back to place if the mouse is off stage.
View 1 Replies
Nov 10, 2009
Can You with a code move the point where the mouse is placed?
Example. If you have a row of buttons on a frame and when you click one of the buttons you don want the mouse to be on that very same spot because on the next frame are the buttons on the same place. You want the mousearrow to be placed on the top of the frame.
View 1 Replies