Jump to content
GreenSock

Michael

Newby|error in a sample

Recommended Posts

hi,

its my first time in TweenMax and i try to do somthing simple.

i take this code from this site:

and i get this error :S

i have AIR 14.0.0

Implicit coercion of a value of type Boolean to a unrelated type Number

package
{
	import com.greensock.*;
	import com.greensock.easing.*;
	import com.greensock.motionPaths.*;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.geom.Point;
	
	/**
	 * ...
	 * @author Michael
	 */
	public class Main extends Sprite
	{
		
		public function Main():void
		{
			
//create a LinePath2D with 5 Points
			var path:LinePath2D = new LinePath2D([new Point(0, 0), new Point(100, 100), new Point(350, 150), new Point(50, 200), new Point(550, 400)]);
			
//add it to the display list so we can see it (you can skip this if you prefer)
			addChild(path);
			
//create an array containing 30 blue squares
			var boxes:Array = [];
			for (var i:int = 0; i < 30; i++)
			{
				boxes.push(createSquare(10, 0x0000FF));
			}
			
//distribute the blue squares evenly across the entire path and set them to autoRotate
			path.distribute(boxes, 0, 1, true);
			
//put a red square exactly halfway through the 2nd segment
			path.addFollower(createSquare(10, 0xFF0000), path.getSegmentProgress(2, 0.5));
			
//tween all of the squares through the path once (wrapping when they reach the end)
			TweenMax.to(path, 20, {progress: 1});
			
//while the squares are animating through the path, tween the path's position and rotation too!
			TweenMax.to(path, 3, {rotation: 180, x: 550, y: 400, ease: Back.easeOut, delay: 3});
		
//method for creating squares
		
		}
		
		function createSquare(size:Number, color:uint = 0xFF0000):Shape
		{
			var s:Shape = new Shape();
			s.graphics.beginFill(color, 1);
			s.graphics.drawRect(-size / 2, -size / 2, size, size);
			s.graphics.endFill();
			this.addChild(s);
			return s;
		}
	}

}
Link to comment
Share on other sites

Hi

 

I am running the latest up to date version of Flash Pro CC 2014 and the highest version of AIR available for publishing is Air 13. I just tested the LinePath2D code from our docs and your code with no errors.

 

The code in LinePath2D (and our demos) hasn't changed in quite a while and has exported flawlessly through many versions of Flash Player. 

 

It appears Air 14 is still in beta. Hopefully Adobe will get their bugs ironed out prior to release.

 

BTW, what line number was giving an error? That would be really helpful to know. 

Thanks.

Link to comment
Share on other sites

TweenPlugin.as line 158

sry for late reply.

do you know when the finel version of AIR 15 come out?>

Link to comment
Share on other sites

Thanks, we will see if anything looks like it could potentially be amiss in line 158 (doubtful).

 

Sorry, I do not have any advance info on when Adobe releases products.

Link to comment
Share on other sites

The conditional logic there is perfectly valid, but I went ahead and reformatted it in a way that should be less offensive to AIR - see the latest version for that change. 

Link to comment
Share on other sites

thank you, its help

but now i see that:

xyzwfjmimwnk.png

Link to comment
Share on other sites

currentTime was from v11. I assume you're using v12 in which case it should be time(). 

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