Reputation: 2087
This is the code that i compiled using mxmlc the free flex sdk. It compiled and i ran it. Helloworld not displayed
package
{
import org.flixel.*;
public class PlayState extends FlxState
{
override public function create():void
{
add(new FlxText(0,0,100,"Hello, World!")); //adds a 100x20 text field at position 0,0 (upper left)
}
}
}
Expected output is = HelloWorld. But is not displayed
Upvotes: 0
Views: 365
Reputation: 49
Try this instead:
package
{
import org.flixel.*;
public class HelloWorld extends FlxState
{
private var title_text:FlxText;
public function HelloWorld() { }
override public function create():void
{
title_text = new FlxText(20, 0, 300, 'Lunarium');
title_text.setFormat(null, 50, 0xffffffff, "center");
add(title_text);
}
override public function update():void
{
if(FlxG.keys.X)
{
FlxG.fade(0xff131c1b, 1, onFade);
}
super.update();
}
protected function onFade():void
{
//FlxG.switchState(new SmallPlay2());
}
}
}
There are plenty of tool tips to help you figure out what the different settings mean. I found flixel rather easy to use coming from a Multimedia Fusion 2 background.
Enjoy!
Upvotes: 1
Reputation: 1155
You'll need to provide an FlxGame subclass too. It may be easiest for you to take an existing Flixel project that works out of the box such as AdamAtomic's HelloWorld and modify it to suit your needs.
Upvotes: 3