Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

making an instance shrink and grow continuously

Guest
Aug 20, 2008 Aug 20, 2008
This is kind of frustrating. According to the Flash help, when using a Tween class, you can refer back to the tween with a "onMotionChanged" and "onMotionFinished" event handlers to call a function after the tween effect has finished or changed. However, in both AS2 and AS3, neither of these work. I get an error in both versions saying that there is no property with the name 'onMotionChanged' or the other. Which means Flash itself does not recognize what it has in its own Help files as a proper event handler. Am I missing something or is this just a cruel joke by them? I have included the import actions in AS. My code is attached.

I'm trying to call repeat the initial tween transition (iconPulse) in reverse order. I want to create an effect of a pulsing image that shrinks and grows.
TOPICS
ActionScript
674
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 20, 2008 Aug 20, 2008
Your problem is one of scope - within onMotionFinished 'this' refers to the
tween class. Use instance names. If that code is on the main timeline, and
you want to tween a clip with an instance name of 'fire', you could use:


import mx.transitions.Tween;
import mx.transitions.easing.*;

var iconPulse:Tween = new Tween(fire, "_yscale", Regular.easeOut, 80, 100,
5,
true);
var iconPulse:Tween = new Tween(fire, "_xscale", Regular.easeOut, 80, 100,
5,
true);

iconPulse.onMotionFinished = function(){
var iconPulse = new Tween(fire, "_yscale", Regular.easeOut, 100, 80, 5,
true);
var iconPulse = new Tween(fire, "_xscale", Regular.easeOut, 100, 80, 5,
true);
}

--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 20, 2008 Aug 20, 2008
LATEST
PS, I'd also suggest using a better tweening class - such as Tweener. A
ping-pong effect using it:

import com.caurina.transitions.Tweener;

function grow(){
Tweener.addTween(fire, {_xscale:150, _yscale:150, time:2,
onComplete:shrink});
}
function shrink(){
Tweener.addTween(fire, {_xscale:100, _yscale:100, time:2,
onComplete:grow});
}

//start it
grow();

--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines