Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I reference an object, add a tween to it and put this in an Eventlistener in AS3?
    text
    copied!<p>I'm having quite some trouble to try and get an app I wrote in <a href="http://en.wikipedia.org/wiki/ActionScript#ActionScript_2.0" rel="nofollow noreferrer">AS2</a> to <a href="http://en.wikipedia.org/wiki/ActionScript#ActionScript_3.0" rel="nofollow noreferrer">AS3</a>. The reason I need to go to AS3 is something icky, so I won't go into detail about it.</p> <p>I've got 90% of the application running with the new code. Now I've come to the point where I have to convert this code from AS2,</p> <pre><code>function setAnimation(theObject,id) { theObject.vensterid=id; theObject.onEnterFrame = function() { var myHoriTween:Tween = new Tween (this,"_x",Strong.easeOut,this._x,(130+((theObject.vensterid-frameno)*260)),1,true); } } setAnimation(venster0,0); </code></pre> <p>, to AS3. My attempt of doing this ended up like</p> <pre><code>function setAnimation(anObject,id) { var theObject = this[anObject]; theObject.vensterid=id; function slideHorizontal(event:Event) { var myTween:Tween = new Tween (theObject,"x",Strong.easeOut,this.x,(130+((theObject.vensterid-frameno)*260)),1,true); } theObject.addEventListener(Event.ENTER_FRAME,slideHorizontal); } setAnimation(venster0,0); </code></pre> <p>and gives me the following non-error (it doesn't show as a compiler error, but as output):</p> <pre><code>TypeError: Error #1010: A term is undefined and has no properties. at sliding_windows_as3_fla::SlideMenu_1/setAnimation() at sliding_windows_as3_fla::SlideMenu_1/frame1() </code></pre> <p>I think this is very strange since it doesn't say anything about which term (and there are quite a lot) and googling didn't find me an explanation either.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload