Class not found

49 views
Skip to first unread message

dumfuck

unread,
May 25, 2015, 12:08:15 PM5/25/15
to haxef...@googlegroups.com
I was following along the haxe flixel guide for the hud creation on the tutorial game. I am currently using this piece of code for a hud
package;

import flixel.FlxBasic;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
using flixel.util.FlxSpriteUtil;



class HUD extends FlxTypedGroup<FlxSprite>
{
   
public var viewerText:FlxText;

   
   
public function new(viewers)
   
{
       
super();
        viewerText
= viewers;
   
}
   
}

When I test the program however I run into class not found: FlxTypedGroup. I can't seem to tell what is wrong with this code.

This is where I am creating my class.
package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import flixel.util.FlxMath;
import flixel.util.FlxColor;


/**
 * A FlxState which can be used for the actual gameplay.
 */

class PlayState extends FlxState
{
   
private var viewers:Int = 0;
   
   
/**
     * Function that is called up when to state is created to set it up.
     */

   
override public function create():Void
   
{
        viewers
= 10;
       
var hudtoadd = new HUD(new FlxText(10,10,500, viewers));
       
//add(hudtoadd);
       
//add(hudtoadd.viewerText);
       
super.create();
   
}
   
   
/**
     * Function that is called when this state is destroyed - you might want to
     * consider setting all objects this state uses to null to help garbage collection.
     */

   
override public function destroy():Void
   
{
       
super.destroy();
   
}

   
/**
     * Function that is called once every frame.
     */

   
override public function update():Void
   
{
       
super.update();
   
}    
}


Gama11

unread,
May 25, 2015, 12:37:47 PM5/25/15
to haxef...@googlegroups.com, them...@gmail.com
You only import FlxGroup, not FlxTypedGroup. You need:

import flixel.group.FlxTypedGroup;

in HUD.hx.

dumfuck

unread,
May 25, 2015, 1:35:30 PM5/25/15
to haxef...@googlegroups.com
Yup thats it. Woops! Thanks a lot.
Reply all
Reply to author
Forward
0 new messages