Hello, I'm kind of new to Greensock (and Flash in general), so sorry if it's a stupid mistake. I'm trying to create a textbox (like in games). I fumbled around with the code until it runs properly. However, once I move onto the third frame, the Output panel gives me an error.
Error: Cannot tween a null object. Duration: 0.3, data: undefined at com.greensock::TweenLite() at com.greensock::TweenMax() at com.greensock::TweenMax$/to() at textbox_fla::MainTimeline/myKeyDown() TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.greensock::TweenMax/render() at com.greensock.core::SimpleTimeline/render() at com.greensock.core::Animation$/_updateRoot()
This is strange, since the function "myKeyDown" is in frame 1. I do not understand why Greensock would throw me an error, since the function is not a functionality of Greensock (it's just a regular AS3 code) . Anyways, here is the code on frame 1.
import com.greensock.*;
import flash.events.KeyboardEvent;
stop();
TweenMax.from(instruc,1,{alpha:0});
TweenMax.from(char1,0.3,{x:"-400"});
TweenMax.from(box, 0.5, {x:"-100", alpha:0});
textbox.visible = false;
TweenMax.delayedCall(0.5, myFunctionL);
function myFunctionL():void{
textbox.visible = true;
TweenMax.from(textbox, 0.3, {x:"-10", alpha:0});
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void{
if(e.keyCode == 32){
TweenMax.to(textbox,0.3,{x:"10",alpha:0});
TweenMax.to(char1,0.3,{x:"-400"});
TweenMax.delayedCall(0.3,frame);
function frame():void{
nextFrame();
}
}
}