Jump to content
Search Community

LiquidStage stage ERROR (beginner question)

zumajoe test
Moderator Tag

Recommended Posts

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

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

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.
×
×
  • Create New...