Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Saturday, September 13, 2008

How to call stage from class!

This topic will talk shortly about the stage class. When we create our new class and need to access to stage class (Main timeline) example "stage.stageWidth"we will see the error "cannot access to null property" or some thing else -*-.I use some easy tip to access to stage class .

code!
package
{
import flash.display.Stage;
public class flashBadass
{
private var __stage:Stage;
public functon flashBadass(st:Stage)
{
__stage=st;
trace(__stage.stageWidth);///easyly but for newbies you will headache with this problem.
}
}
}

On timeline when you create new instace of this class you must pass stage to the method.
import flashBadass;
var flBadass:flashBadass = new flashBadass(stage);

I dont know if you had other way to do please tell me.*-*

Hudsadin keox