0

A little Backstory: I took on an AS3 project at university, no one of the original team is left/reachable. I was originally told I only nead FlashDevelop. I don't have to alter the code yet, just compile it. I'm pretty good at java programming with eclipse, but AS3 and Flashdevelop are new for me. (Of course I read into it before starting!)

I am using FlashDevelop 4.0.1 and Flex SDK 4.6.0.

When I first tried to compile it, I got the folling error:

svn\trunk\src\com\hybrid\ui\ToolTip.as(381): col: 38 Error: Type was not found or was not a compile-time constant: TweenEvent.

So I researched on the Internet and came to the conclusion that TweenEvent isn't even part of Flex SDK 4.6.0, but that I needed Adobe CS Flash for that. That was supported by the fact how the Config.xml looked. This two lines where added to the project path.

<path-element>C:\Program Files (x86)\Adobe\Adobe Flash CS3\de\Configuration\Component Source\ActionScript 3.0\User Interface</path-element> 
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\ActionScript 3.0\projects\Flash\src</path-element> 

So I ordered Flash and got Adobe Flash CS6. And now thing start to not make sense anymore. I added the line below, which I thought would be the appropriate aquivalent to one of the lines above. (censored the name)

path-element>C:\Dokumente und Einstellungen\***\Adobe\Adobe Flash CS6\Common\Configuration\ActionScript 3.0</path-element> 

And the error changed to:

C:\Dokumente und Einstellungen\***\Desktop\HiWi\iml-as3-svn-110718-11-04\svn\trunk\src\IML.mxml(106): Error: Could not resolve <ns1:ULog> to a component implementation.

Then I tried adding the second line which I couldn't find an exact match for, so I tried adding

<path-element>C:\Dokumente und Einstellungen\***\Adobe\Adobe Flash CS6\de_DE\Configuration\ActionScript 3.0</path-element> 

And with doing that I got the exact first error.

svn\trunk\src\com\hybrid\ui\ToolTip.as(381): col: 38 Error: Type was not found or was not a compile-time constant: TweenEvent.

So now I am at a complete loss, I don't know where I went wrong, so some help would really be appriciated. Please tell me if you need to see code or if I went completely wrong somewhere. I know it's a very specific problem, but I hope someone with more expertise sees things I don't. I'll be here almost all day today and tomorrow, so if I get some answers I will try it immediatly. Thank you in advance!

Edit: It seems that only one class uses this (unless I overlooked something). The import statement is:

import fl.transitions.Tween;    
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

So, does that mean I need those files? But shouldn't have the path added above fixed that?

I don't want to post the whole class because it's rather long, so here everything, that uses Tweens. Looking at it now this doesn't seem to be that much.

private var _tween:Tween;


/* Fade In / Out */

    private function animate( show:Boolean ):void {
        var end:int = show == true ? 1 : 0;
        // added : DR : 04.29.2010
        if( _tween != null && _tween.isPlaying ) {
            _tween.stop();
        }
        // end add
        _tween = new Tween( this, "alpha", Strong.easeOut, this.alpha, end, .5, true );
        if( ! show ){
            _tween.addEventListener( TweenEvent.MOTION_FINISH, onComplete );
            _timer.reset();
        }
    }

    private function onComplete( event:TweenEvent ):void {
        event.currentTarget.removeEventListener(event.type, arguments.callee);
        this.cleanUp();
    }

    /* End Fade */
Syrina
  • 1
  • 1
  • Have you posted on the flash develop forum also? It certainly sounds like some classes were used that are not in the project you have now. You need to find out what is missing and either get them in a swc file and add to the library in Flash Develop or if possible remove the tweening code altogether and go for TweenMax library, you can get that for free and drop that swc in your library. Can you post any code that uses that TweenEvent? – Neil Jul 05 '12 at 08:37
  • No, I haven't posted on the forum. I'll edit in the other information you asked for. – Syrina Jul 05 '12 at 08:43
  • Try `import flash.events.*;` and `private var _tween:Tween = new Tween;` (instead of the existing `private var _tween:Tween;`) for a starters, and let us know if it made any difference ;) – paddotk Jul 05 '12 at 09:54
  • Also, those imports are standard Flash classes, and you don't need to have those class files. At least not in Adobe Flash, can't be 100% sure for FlashDevelop. – paddotk Jul 05 '12 at 09:56
  • And the OP calls that " *A **little** Backstory* " – Pranav Hosangadi Jul 05 '12 at 09:57
  • @poepje the import is already there (I just didn't post it) and the other line didn't make any difference. – Syrina Jul 05 '12 at 12:04
  • @Neil Can you tell what difference it makes if I get there in a swc or if I add them to the project via adding the class path? And how hard would it be to rewrite that method in TweenMax? – Syrina Jul 05 '12 at 12:07
  • If you can zip your project somewhere, I'll take a look at it for you. – Neil Jul 05 '12 at 19:44
  • @Neil I'm sorry, but I'm not allowed to give away the code. Can you still help me and try to answer the questions above? – Syrina Jul 06 '12 at 04:22

1 Answers1

2

If you are using Flash Develop I would go and download the AS3 package for TweenMax from Greensock. In the resulting zip you will find the source, examples and a pre-compiled swc.

You can either reference the swc in your project or the classes in the com folder directly, that's up to you.

TweenMax can do anything the fl.transitions.Tween class can do and so much more. On the Greensock site there are lots of instructions telling you what each property does and also a really cool animation explorer right there in the page, so you can see what it will do, and it also show's you the resulting code.

enter image description here

It's as easy as doing:

import com.greensock.*;

// this will tween `mc` from whatever alpha it is now to 1.
TweenLite.to(mc, 1, {alpha:1});

Obviously there's a multitude of properties and callbacks you can tween, so I suggest you head over there and have a read. The code you have above can be converted to use Tween max and I'm sure you will use it for all flash animations in the future.

Neil
  • 7,861
  • 4
  • 53
  • 74
  • 1
    +1, Greensock is probably the best tweening engine. You should consider this library. – Florent Jul 09 '12 at 09:10
  • Ok, thanks a lot, I will take a look at it tomorrow (I'm not working on the project today). Can someone tell me what my code above does exactly? I'm not familiar with fl.transitions. – Syrina Jul 10 '12 at 08:12