Skip to end of metadata
Go to start of metadata

How Do We Expose Scoring?

Now that we have explored how we expose both vector and bitmap images we will look at how we can use a graph token to access a variable in our game that will print out to a score. This is the hardest section in this Quick Start considering that we will now learn how to  expose a function that provides the dynamic textbox a variable to print out. Through this section you will learn a valuable aspect of UI and how easy it is to show your score or game time on screen for more engaged gameplay.

 

Steps for Exposing a Variable to Dynamic Text

  1. Draw a Dynamic Textbox inside of our Flash canvas and typing in the word "TEST." We will also name the instance to "myTextbox" and click the Selectable Button to disable.

  2. Access the Actions Window by either pressing F9 or going to Window -> Actions in the menu. 

  3. Considering this is the most basic form of Actionscript we can enter, we will house the script on the default layer as is and enter the following code to expose our parameter to a Scaleform function:

    uiQuickStart.fla
    updateText = function(myText:String)
    {
    	myTextbox.text = myText;
    } 
     
    updateText ("TEST2");



  4. Now that we have exposed our parameter we can compile our GFx file through the exporter and enter the following adjustments to our UIElements file to expose the parameter to Flow Graph.

    uiQuickStart.xml
    <functions>
    	<function name="UpdateText" funcname="updateText" desc="Updates our score">
    	<param name="text" desc="New score" type="int" />
    	</function>
    </functions>




 

Step 1


Step 2


Step 4


 

  • No labels