Share Posted April 27, 2010 Hey there, Just became a club greensock member... excited to use liquid stage! I'm new to using classes, so could I get a little guidance with the following? I'm trying to implement LiquidStage into Gaia framework but i'm getting an error: Error: LiquidStage error: you must define a valid stage instance in the constructor. If the stage is null, please addEventListener(Event.ADDED_TO_STAGE) one of your DisplayObjects and wait to create the LiquidStage instance until AFTER the stage property is not null. at com.greensock.layout::LiquidStage() at pages::IndexPage() Inside of the Indexpage.as class file, this is my code: package pages{ import com.gaiaframework.templates.AbstractPage; import com.gaiaframework.events.*; import com.gaiaframework.debug.*; import com.gaiaframework.api.*; import flash.display.*; import flash.events.*; import com.greensock.TweenMax; import com.greensock.layout.*; public class IndexPage extends AbstractPage { public var bg_clouds:MovieClip; public function IndexPage() { super(); alpha=0; trace("construct"); var ls:LiquidStage=new LiquidStage(this.stage,550,555,550,555); var area:LiquidArea=new LiquidArea(this,100,100,350,150,0x313f19); area.preview=true; area.attach(bg_clouds); //new Scaffold(this); } override public function transitionIn():void { super.transitionIn(); TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete}); } override public function transitionOut():void { super.transitionOut(); TweenMax.to(this, 0.3, {alpha:0, onComplete:transitionOutComplete}); } } } Link to comment Share on other sites More sharing options...
Author Share Posted April 28, 2010 Problem solved! Was trying to initiliaze the LiquidStage too soon... updated code: package pages{ import com.gaiaframework.templates.AbstractPage; import com.gaiaframework.events.*; import com.gaiaframework.debug.*; import com.gaiaframework.api.*; import flash.display.*; import flash.events.*; import com.greensock.TweenMax; import com.greensock.layout.*; public class IndexPage extends AbstractPage { public var bg_clouds:MovieClip; public function IndexPage() { super(); alpha=0; } private function init():void { var ls:LiquidStage=new LiquidStage(this.stage,550,555,550,555); var area:LiquidArea=new LiquidArea(this,100,100,350,150,0x313f19); area.preview=true; area.attach(bg_clouds); } override public function transitionIn():void { super.transitionIn(); init(); TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete}); } override public function transitionOut():void { super.transitionOut(); TweenMax.to(this, 0.3, {alpha:0, onComplete:transitionOutComplete}); } } } Link to comment Share on other sites More sharing options...
Share Posted April 28, 2010 Bingo. Good job. Yeah, if the object isn't added to the stage yet, its "stage" property will be null, but LiquidStage needs a valid stage to do its magic. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now