Jump to content
Search Community

Any reason this would not work?

Popinjay test
Moderator Tag

Recommended Posts

TweenMax.fromTo(gg, 3, {per:.1},{per:1, onUpdate:og.setFadeByPer, onUpdateParams:[gg.per], onComplete:finishedFade});

 

To change value of variable per from object gg from .1 to 1?

 

Earlier in the class I have:

 

    public class myOnionSkinFade extends Sprite
    {


        var backgroundData:BitmapData = new BitmapData(1,1);
        var tileData:BitmapData = new BitmapData(1,1);
        var gc:myGraphicsClass = new myGraphicsClass  ;
        var backdrop:Bitmap = new Bitmap  ;
        var myTimeline:TimelineMax = new TimelineMax({paused:true, onComplete:timelineComplete});
        var og:Object = new Object;
var gg:Object = new Object;


        public function myOnionSkinFade(tOb:DisplayObjectContainer, tile:DisplayObjectContainer, perBurn:Number = 5)
        {

gg.per = .1;

 

... the rest omitted for space reasons

Link to comment
Share on other sites

prior to running the tween add

 

 

 

trace("gg.per = " + gg.per) 
 

 

 

just to make sure you have access to that object and its per property at that point in the time

 

I don't know what your onUpdate callback is supposed to be doing but since you are passing gg.per in as a param, keep in mind that the callback param value does NOT change as the tween is running. It will continually pass in the same value that gg.per evaluates to when the tween is created.

 

I think you should just pass in a reference to gg like so

 

 

TweenLite.to(gg, 1, {per:10, onUpdate:someFunction, onUpdateParams:[gg]});

function someFunction(obj:Object) :void{
    trace(obj.per);
}
 

Let us know if this works for you.

Link to comment
Share on other sites

prior to running the tween add

 

 

 

trace("gg.per = " + gg.per) 
 

 

 

just to make sure you have access to that object and its per property at that point in the time

 

I don't know what your onUpdate callback is supposed to be doing but since you are passing gg.per in as a param, keep in mind that the callback param value does NOT change as the tween is running. It will continually pass in the same value that gg.per evaluates to when the tween is created.

 

I think you should just pass in a reference to gg like so

 

 

TweenLite.to(gg, 1, {per:10, onUpdate:someFunction, onUpdateParams:[gg]});

function someFunction(obj:Object) :void{
    trace(obj.per);
}
 

Let us know if this works for you.

YES!  That was the problem.  The value was not changing.  Thanks for the quick and accurate help.

 

Pop

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...