ActionScript 3.0 :: Motion XML Resets DisplayObject Position / Scale?

Jul 16, 2009

I animate a DisplayObject with a Motion XML (exported from Flash). The first time I apply a motion to it, everything works fine. The second time I apply a motion, the position / scale is reset to what it was before I first applied a motion. How can I keep the transform of the DisplayObject after a motion is played when I want to play a new motion ? I want the DisplayObject to start from where it was at the end of the first motion.Here's the code I use:

private function animate(motionXML:XML, target:DisplayObject):void
if(!animator)animator = new Animator(motionXML, target);
// Add event listerners

[code].......

View 5 Replies


Similar Posts:


ActionScript 2.0 :: Load Mp3's So The Sound.position Property Resets?

Oct 17, 2006

Basically I have an XML file that contains the paths of a few mp3 files. I have a Play button that plays them and a Next button that plays the next song on the list. These buttons work fine. I actually even am able to obtain and manipulate the songs position using the mySong.position property in order to display the songs position in the form of minutes and seconds.My problem is that when you click Next to go to the next song, the mySong.position property does not reset back to zero, like it should. So if you are 12 seconds into a song and you click NEXT, the next song starts to play fine, but the display keeps counting up from 12 seconds. I realized the .position property is read-only, so I cannot change it. If this is the case, then how does it ever reset, what causes it to reset?

I am loading the songs via the loadSound() method. Which means my only code on the Next button (other than to update some other displays) is:Code:mySound.loadSound("file.mp3", true);I do not need to use mySound.stop() to stop the previous sound, or even mySound.start() to start the new sound playing, it starts automatically. I tried using those commands and got the exact same results, the position property still did not reset.Am i missing something? I sure hope its painfully obvious and I just overlooked something simple cuz im getting a headache

View 9 Replies

ActionScript 3.0 :: Make A Button That When Pressed It Resets/changes The Position Of A Object?

Nov 6, 2010

button to reset position (action-script 3)  how do you make a button that when pressed it resets/changes the position of a object yes i am new to action script 3 but not to flash i want button to change the x y coordinates back to the original but dont know how?     

View 1 Replies

ActionScript 3.0 :: Make Filters Scale Relatively With Parent DisplayObject?

Nov 28, 2009

S there any way filters applied to a DisplayObject (drop shadow, glow, bevel) can scale relatively with the parent (the DisplayObject it is inside)?And what about other properties like .distance for drop shadow?For example... If I have a 100px rectangle with a 10px glow inside a container object, and I set scaleX/scaleY of the container to .1, I want the glow to inherit the scale change from the parent (1/10th the size) just as the display object does that the filter is applied to.Instead, if you try this, you will see the glow stays at 10px no matter what scale the filter target or the container is transformed by.Pseudocode example (steps to reproduce),

1) create a sprite called _myOuterSprite on stage at scaleX = scaleY = 1

2) create a sprite called _myInnerSprite inside _myOuterSprite at scaleX = scaleY = 1

3) draw 100px rectangle into _myInnerSprite

4) apply 10px glow to _myInnerSprite

5) transform scale of _myOuterSprite to .1

Result:

- child sprite (rectangle) scales to 1/10th the size

- glow stays the same size

How can I make it so that glow scales to 1/10th as well?

...without capturing and scaling bitmap data

...without losing interactivity on objects

...in a way that would work visually for every filter, not just glow (drop shadow has distance property too, etc)

View 7 Replies

Actionscript 3.0 :: Scale DisplayObject Based On Visible Bounds

Nov 5, 2010

I've been banging my head trying to figure out how to get this to work with no success... I have a class that extends MovieClip which loads a large image into it. This image has a mask applied to it to only display a specific section of the image. I need to be able to scale this MovieClip based on it's visible width & height while maintaining it's proportions.

I'm currently using Collin Moocks' approach (see it here:[URL]) to get the visible width and height of the movieclip, but I can't figure out how to get it to scale correctly based on those dimensions... Preferably I'd like to be able to set it's visible scaleX & scaleY properties similar to how you currently set the scaleX & scaleY, (i.e. movieclip.visibleScaleX = 1.5).

View 2 Replies

ActionScript 3.0 :: Flex - Make Filters Scale Relatively With Parent DisplayObject?

Nov 28, 2009

(i'm using flashdevelop / flex sdk)IS there any way filters applied to a DisplayObject (drop shadow, glow, bevel) can scale relatively with the parent (the DisplayObject it is inside)?And what about other properties like .distance for drop shadow?

For example... If I have a 100px rectangle with a 10px glow inside a container object, and I set scaleX/scaleY of the container to .1, I want the glow to inherit the scale change from the parent (1/10th the size) just as the display object does that the filter is applied to.Instead, if you try this, you will see the glow stays at 10px no matter what scale the filter target or the container is transformed by.Pseudocode example (steps to reproduce),

1) create a sprite called _myOuterSprite on stage at scaleX = scaleY = 1

2) create a sprite called _myInnerSprite inside _myOuterSprite at scaleX = scaleY = 1

3) draw 100px rectangle into _myInnerSprite

4) apply 10px glow to _myInnerSprite

5) transform scale of _myOuterSprite to .1

Result:

- child sprite (rectangle) scales to 1/10th the size

- glow stays the same size

How can I make it so that glow scales to 1/10th as well?...without capturing and scaling bitmap data ...without losing interactivity on objects...in a way that would work visually for every filter, not just glow (drop shadow has distance property too, etc)

View 4 Replies

ActionScript 3.0 :: Which DisplayObject Is Visible At Position X,y

Mar 3, 2009

I want to know which DisplayObject that is visible atposition x,y. Unfortunately, hitTestPoint returns true even ifanother DisplayObject lies above and blocks all visibility. Forexample:

View 7 Replies

Scale Transformation Of A Symbol Within A Motion Tween

Nov 29, 2009

I'm making a very simple animated flight plan with 3 airfields and six airplanes as seen from the top. To imitate the effect of take off and landing I want to be able to change the size of the plane when it flies.Only trouble is I can do that only with the Free Transform Tool. Even if I select Modify -> Transform -> Scale I have to change the shape of each object manually and they end up having different sizes. I tried editing the size in the properties box but the fields are greyed out. Any idea how I can change that.

View 2 Replies

Scale Multiple Objects And Motion Paths At Same Time In CS4

Oct 19, 2009

I have a CS4 document with many objects, motion paths over multiple layers. I want to scale everything, including the motion paths of each object. I've tried to do this by Clicking 'Edit Multiple Frames', then 'Selecting All Frames' and finally scaling everything via the Transform panel. Everything appears to have been scaled apart from the motion paths. Is there a way to do this?

View 2 Replies

Actionscript 2 :: Flash - Scale A MC From Center Position?

Nov 25, 2011

I am using AS2 and I'm looking for a way to scale an MC from the center meaning that the width will expand equally on both sides.For example .. If the movie clips needs to expand +10 then it would be +5 on the left and +5 on the right.So, in order to simulate the movie clip going forward the position on the left would offset -5 then scale.

View 2 Replies

ActionScript 2.0 :: Rectangle Keep Its Size (no Scale) And Position?

Sep 15, 2010

I have a problem with stage resize.I have a small rectangle on the right bottom of my stage. When I resize the stage, I want my rectangle keep its size (no scale) and position ( always on the right bottom of the stage). Here is my code:

mymc._width = 50
mymc._height = 20
Stage.scaleMode = "noScale";[code].......

View 6 Replies

ActionScript 2.0 :: Scale Too Say 150% And Move To A Different X Y Position And Zoom

Apr 19, 2004

how i could create a function to do the following:- I have a mc and when you click on it i want it to scale too say 150% and move to a different x y position, then when you click on it again i want it to go back to its original size and position.

View 4 Replies

ActionScript 2.0 :: Calculate The Exact Position And Scale?

May 15, 2006

imagen I have a movieclip (space_mc) w1000Xh1000 px?

inside the space_mc I have 2 movieclips:
- vlak1_mc (w100xh100px, _x:100,_y:100);
- vlak2_mc (w100xh100px, _x:400,_y:400);
ok!?

now i put the space_mc on the stage and scale it to 20% the stage (document properties) are w800xh600

Now i want that the USER clicks on vlak1,2_mc and the space_mc scales to 100% But the clicked vlak(1,2)_mc must have the exact coordinates as in the space_mc?

so if clicked on the vlak1_mc!

the space_mc zooms in to 100% and the _x,_y of the vlak1_mc are x100,y100 on the stage(800x600)?

[URL]

View 1 Replies

ActionScript 3.0 :: Use An IF To Check The X Position Or Scale Of The Target MC?

Jan 22, 2010

I have a MC on the stage and when the user clicks on it I want it to center itself and scale up. Then when the user clicks on it again I want it to return to its original position and scale. Then they can click on the next MC which would do the same thing. Any suggestions on how to handle this? I was thinking of adding the event listener, of course, and inside the handler function I would use an IF to check the x position or scale of the target MC. Is this a "clean" way of doing it?

View 2 Replies

ActionScript 2.0 :: [CS5] External Swf Into Movieclip Scale And Position?

Feb 2, 2011

[URL]while in "portfolio" section, if you resize, the content go to the left.I know WHY it does it : while in a MC, an external movieclip lose his stagesize to compress into the movieclip, if resize, it use the size of ALL the content in the SWF to resize. the external fla stage is 1600 x 680, but the content goes out of the stage to the right to make an 1760 x 680 size.to make it LOAD at the right place and right size, i've got a layer with a MC (externalStageSize) in the external SWF that is the size of the Stage, while on frame 1, only this MC(externalStageSize) is active, so when loaded, the _level0 flash can position and scale the external SWF.

BUT, while active content is on, any live resize does not go well..I tried to "connect" the scaling with (externalStageSize) BUT once loaded the size does not change.I wanted to use the math : "new width" = ("allcontent".width / externalStageSize._width)/Stage.width but _level0.ContentMC.externalStageSize._width return the value it have in the flash... like, even if rescale, it will say "1600" is there a way to counter this ? before you ask : AS3 was out of the question because the person who will maintain the site is not that advanced.

some script used when resize :
ContenuMC : the movieclip in witch external swf is loaded

Code:
function setContent() {
// content dimensions
ContenuMC._width = Stage.width;

[code]....

View 1 Replies

ActionScript 3.0 :: Scale Inverse To Slider Position?

Nov 15, 2011

I have a var that captures a slider position like this:

Code:
var sliderPosition = Math.round((thumb.y-bounds.top)/(bounds.right-bounds.top)*100);

which outputs a number between 0 and 100 starting on 0. I need to scale an mc from 1 at sliderPosition =0 to .42 at sliderPosition = 100.

View 1 Replies

ActionScript 2.0 :: CS3 Scale MovieClip But Adjust X Position Of MC's To Left And Right Of It

Sep 14, 2010

I have 4 movieClips on stage named text1, text2 etc. When I RollOver any one of them I have a tween which changes their xscale and yscale. So basically when you rollover they get bigger and when you rollout they go back to 100 scale.

What I want to be able to do is make it so that if I hover over item 3 then item 4's x position is shifted according to the scale of item 3. I ALSO want to be able to move items 1 and 2 to the left to account for the new scale. I can do this but only by moving things to the right, I cannot understand how to make items to the left of that selected update their x position to account for the scale.

the code I'm using is:

[Code].....

The onEnterFrame function is working but only shifting the x position of items that are on the right of that currently selected - it doesn't scale the selected item and shift things left and right accordingly.

View 4 Replies

ActionScript 3.0 :: Nested Movieclip Global Position (with Scale)

May 18, 2010

Let me try my best to explain this... On the stage I have a master movieclip, for explanation purposes, let's call this movieclip "body". Nested inside of body are several other movieclips (we'll call them anatomy items like: arm, hair, foot, etc) Now let's say we scaled body to 200% (body.scaleX = body.scaleY = 2.0)

When I run localToGlobal on one of the nested anatomy movieclips (e.g. arm), actionscript is returning the x and y values of the initial state, not reflecting the scale of body and how it actually caused the arm's position to shift globally.

View 0 Replies

ActionScript 2.0 :: Moving Menu - Change Scale And Position

Mar 21, 2004

The selector mark is suposed to "mark" the selection on the menu after a selection is pressed. But Im having problems with the X and y coordinates and scales of the MC and when I click on the option, the MC gets smaller and then bigger to the size I want. Its suposed change scale and position but its not working like it is suposed to work. Im not sure either if I�m setting the Mc on the initial x and y coordinates.

View 4 Replies

ActionScript 2.0 :: Shift / Scale Relative To Position At Click

Aug 19, 2006

I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:Url...

View 8 Replies

ActionScript 2.0 :: Image Pan - Want To Center/scale Relative To Position At Click?

Aug 19, 2006

I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:If anyone knows of a tutorial or example out there, I'd love directions to it(them). or,

View 1 Replies

ActionScript 2.0 :: Scale And Zoom - Back To Its Original Size And Position?

Apr 19, 2004

how i could create a function to do the following. I have a mc and when you click on it i want it to scale too say 150% and move to a different x y position, then when you click on it again i want it to go back to its original size and position.

View 3 Replies

ActionScript 2.0 :: Motion Path Relative To Mouse Position

Nov 10, 2007

im using MX 2004 although i do have Flash 9 atm if anyone has an example in that
Anyway, im trying to slow down and speed up an orbit of an mc relative to where the mouse position is. So basically i need some sort of radial "field" where when the mouse gets close to the outside of the orbit the movie clip stops and when it is farther away the movie clip speeds up.

[Code]...

View 1 Replies

ActionScript 3.0 :: Detect Actual Mouse Position After Quick Motion?

Mar 9, 2007

I am replacing the mouse pointer with a custom graphic in an .swf that takes up part of a web page (.swf stage is about 350px wide, total layout is about 1000px). My code is all working fine, except that, if you move the mouse fairly quickly -- as you might do to get from a point on the .swf to the opposite side of a large monitor -- the .swf loses track of the mouse, and thinks that the ._xmouse/._ymouse values are still the same as the last point that that Flash saw the mouse, which is usually somewhere in the middle of the stage, thus "orphaning" the custom cursor. If I have a setInterval or something tracing the mouse position, the .swf still thinks that the mouse is sitting on top of it, even though the cursor is actually far away somewhere else. hitTest also still returns true as though the mouse was there (as you might expect, given that it's based on _xmouse/_ymouse).

The workaround/hack I have going now is that, once the pointer switches over to the custom cursor, it starts a setInterval, and then if the mouse appears not to move for a few seconds, it reverts back to the default cursor (i.e., Mouse.show). Obviously, this is not optimal, because that means that the custom cursor disappears if you don't move the mouse for a second or two, and it doesn't really solve the problem anyway because it still looks like the custom cursor gets stuck for a second when you move too fast.

[Code]...

View 4 Replies

ActionScript 2.0 :: Circular Motion - Change The Position Of The MovieClip At Every 22.5 Degrees

Jul 17, 2004

can someone explain the logic of circular motion (them radians and degrees). I've found the code for it and modified it a bit to make it do what I want. But I haven't a clue as to how it works.. This is a slightly modified code taken from the Kirupa Tutorial.

[Code]...

View 1 Replies

ActionScript 2.0 :: How To Stop Motion - Rest / Settle At The Position Until The Mouse Is Moved Again

Apr 7, 2008

i have a fish that follows the mouse position. Im working out the angle and distance it is from the mouse cursor and telling it to swim in that direction. But when he gets there he flickers back and forwards. How can i get him to rest/settle at the position until the mouse is moved again.

[code]...

View 3 Replies

ActionScript 2.0 :: Logic Of Circular Motion - Code Will Change The Position Of The MovieClip At Every 22.5 Degrees?

Jul 17, 2004

explain the logic of circular motion (them radians and degrees). I've found the code for it and modified it a bit to make it do what I want.But I haven't a clue as to how it works..This is a slightly modified code taken from the Kirupa Tutorial.

xcenter = 0;
ycenter =0;
onClipEvent (enterFrame) {[code]....

The above code will change the position of the movieClip at every 22.5 degrees (thereby making sixteen distinct stops) and will trace a circle of radius 100 px. concept behind the math equations?

View 1 Replies

ActionScript 3.0 :: Draw Motion Guide/path For A Mouse Position Based Movement?

Mar 22, 2011

Is it possible to draw motion guide/path for a mouse position based movement?

For example if I have path the is like letter H. I would need to write many clauses/conditions for the borders of the movement. It would be a LOT easier if there would be some solution that makes the object always to stay on the defined path when moving..

View 2 Replies

Flash :: Check If DisplayObject A Is A Descendant Of DisplayObject B?

Oct 26, 2010

I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.

[Code]...

View 2 Replies

ActionScript 3.0 :: Height Resets To 0 Every Other Frame?

Jun 10, 2009

I'm writing a base class for a clip that holds a scrollbar and some content. I written a function that runs every frame to check if the height of the content is smaller than the height of the available content area. If it is, the scrollbar hides. The problem I've run into is that when i trace the height, every other frame it comes back as 0. If I trace the same exact value when it's used in another function it comes back correct every time. If I trace it in my document class, it comes back correct. Any idea why it comes back zero in just this one spot?

enableScrollBar(); is the function in question

Code:

package includes {
import flash.display.MovieClip;
import flash.events.Event;

[code]....

View 2 Replies







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