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

1 comment:

Anonymous said...

///easyly but for newbies you will headache with this problem

If you're going to call yourself the flash bad ass, can you at least check your posts for spelling errors before you heave them out on the internet?

It makes me wonder if your code is as sloppily thrown together as your writing.