FlxTypeText Callback



  • Another Question about my project.

    im Using the FlxTypeText Class FlxTypeText

    /*
     * This function calls requestText(), adds the Tutorial array and starts the animation
     * at the end increases the textstate by 1.
     * */
    public function StartText():Void
    {		
    	requestText();// Calling the function that gets the text from the Sqlite DataBase				
    	add(tutorialArray[textState]);
    	tutorialArray[textState]._text.start(0.05, false, true,keysArray,StartText);		//TODO: Fix it that after the first text is erased start the next one. 
    	
    	textState ++;
    	
    }
    

    If i run the project now the next Text Starts already before the first one gets erased + it keeps adding text on the screen. ( i only have 4 different texts in my database but after the last one is done the first one starts again).

    Is there a way to add the next text after the first text is erased completly?

    Thanks in Advance!



  • If I understand your problem correctly, try adding a function EraseText() which is the callback from the FlxTypeText start function. In this function use FlxTypeText erase with StartText as it's callback function.



  • I ran into a similar problem during my last LD jam .. where I had to show next typeaText only after the last one was completed .. so here is how I did it. if you want you can check the game source code from here

    public function updateChoice(i:Int)
    	{
    		if(i ==  choices.length)
    		{
    			return;
    		}
    		choices[i].start(0.04, true, false, null,updateChoice.bind(i+1));
    	}
    
    

Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.