Jump to content
Search Community

ALIGN_SEQUENCE problem [SOLVED]

mgason test
Moderator Tag

Recommended Posts

Hi,

I came across this post and wanted to play with the concept

viewtopic.php?f=1&t=287

 

when I try to run the code supplied I get this error

1119: Access of possibly undefined property ALIGN_SEQUENCE through a reference with static type Class.

 

I am running V11 and bonus items

 

for convenience, here is the code just like the post I mentioned

I have not changed anything except gs to com.greensock

thanks mark

 

import flash.display.*;
import com.greensock.*;
import com.greensock.easing.*;

var line:Shape = new Shape();
line.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);

this.addChild(line);
line.x = 50;
line.y = 50;

var drawer:Sprite = new Sprite();
this.addChild(drawer);

var sequence:TimelineLite = new TimelineLite({tweens:[
                       [drawer, 0.1, {x:200, ease:Quad.easeOut, onUpdate:drawLine}],
                       [drawer, 0.1, {y:100, ease:Quad.easeOut, onUpdate:drawLine}],
                       [drawer, 0.1, {x:0, ease:Quad.easeOut, onUpdate:drawLine}],
                       [drawer, 0.1, {y:0, ease:Quad.easeOut, onUpdate:drawLine}]], align:TimelineLite.ALIGN_SEQUENCE}); 

function drawLine():void {
  line.graphics.lineTo(drawer.x, drawer.y);
}

Link to comment
Share on other sites

Yep, the problem is that the code you referenced was from a beta version of v11, but the alignment constants were moved to their own TweenAlign class before the official launch. So TimelineLite.ALIGN_SEQUENCE would be TweenAlign.SEQUENCE. It's all in the docs. http://www.greensock.com/as/docs/tween/

 

Here's the revised code:

 

import flash.display.*;
import com.greensock.*;
import com.greensock.easing.*;

var line:Shape = new Shape();
line.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);

this.addChild(line);
line.x = 50;
line.y = 50;

var drawer:Sprite = new Sprite();
this.addChild(drawer);

var sequence:TimelineLite = new TimelineLite({tweens:[
                          new TweenLite(drawer, 0.1, {x:200, ease:Quad.easeOut, onUpdate:drawLine}),
                           new TweenLite(drawer, 0.1, {y:100, ease:Quad.easeOut, onUpdate:drawLine}),
                           new TweenLite(drawer, 0.1, {x:0, ease:Quad.easeOut, onUpdate:drawLine}),
                           new TweenLite(drawer, 0.1, {y:0, ease:Quad.easeOut, onUpdate:drawLine})], align:TweenAlign.SEQUENCE});

function drawLine():void {
    line.graphics.lineTo(drawer.x, drawer.y);
}

Link to comment
Share on other sites

It seems to me that code and nothing else should draw a rectangle?

No movie clips etc required in the FLA just this code.

 

When I run it I get this error "TypeError: Error #1009: Cannot access a property or method of a null object reference."

at com.greensock::TimelineLite/insert()

at com.greensock::TimelineLite/insertMultiple()

at com.greensock::TimelineLite()

at drawwithtweenmax_fla::MainTimeline/frame1()

 

debug takes me to line 329 in TimelineLite.as

 

tween.cachedStartTime = Number(timeOrLabel) + tween.delay;

Link to comment
Share on other sites

Sorry, I forgot to mention that you were using the shortcut array syntax that was in an early beta version of TimelineLite/Max but was removed before final launch of v11. The corrected code would look like:

 

import flash.display.*;
import com.greensock.*;
import com.greensock.easing.*;

var line:Shape = new Shape();
line.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);

this.addChild(line);
line.x = 50;
line.y = 50;

var drawer:Sprite = new Sprite();
this.addChild(drawer);

var sequence:TimelineLite = new TimelineLite({tweens:[
                          new TweenLite(drawer, 0.1, {x:200, ease:Quad.easeOut, onUpdate:drawLine}),
                           new TweenLite(drawer, 0.1, {y:100, ease:Quad.easeOut, onUpdate:drawLine}),
                           new TweenLite(drawer, 0.1, {x:0, ease:Quad.easeOut, onUpdate:drawLine}),
                           new TweenLite(drawer, 0.1, {y:0, ease:Quad.easeOut, onUpdate:drawLine})], align:TweenAlign.SEQUENCE});

function drawLine():void {
    line.graphics.lineTo(drawer.x, drawer.y);
}

Link to comment
Share on other sites

Thanks,

you rock, something I tell all my Flash using pals.

It still amazes me that you develop the tweening platform, work, and still find time to answer most of the posts on this forum

 

Thanks, Mark. Yeah, I just don't sleep. It allows me to fit a lot more into my schedule. :)

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...