Search Tutorials
The Examplego ahead and try itIf you've tried it twice once by using the enter key and once by using the Press button you'll notice you get two different results. That's because I've assigned two different expressions to the dynamic text box. But thats for later on Lets work on some basics first. <%BK%> Input Text
![]() Due to reserved words being used in actions/expressions it's wise not to use certain words
such as "text, Sprite, parent child or using the same word for multiple objects (sprites with the same name
text with the same name etc) as well never start a name with a number swish will try to correct it if you do
but in general it's a bad practice)
Test your movie out hit scene play you should be able to back out any text and replace it with new text.
What have you done. You have created a variable for storage. A variable is simply a box that holds data. Data can be stored locally on to a computer or onto a server. Because we are just starting out the data is only temporary.
Later you may wish to learn more about storing data such as cookies, shared objects or to a database.
But for now lets keep it simple. Variables aren't always text although it is the default setting for swishmax. Swishmax can interpert variables to a certain degree somevariables such as currency or boolean statements(true false) must be defined as such although swishmax does a pretty good job of figuring out what type of variable is being stored. We'll discuss a bit more about variables later on. For now lets take a break and create our Dynamic text.
<%BK%>
The Dynamic Text blockJust as Before,,,
Take a break breathe let it all soak in. Here comes the last part. <%BK%> Back already? Well okay I'm sure you want to get this stuff done with. Our ButtonCreate Select the object you want to act as a button. (text shape anything but the input or dynamic text.you've just created.
![]() Go back to the stage view and test your movie So where did all that other stuff come from? And how can I do that? When you use a variable in an expression you simply include the name. When however you wish to use Text or what the rest of the programming world refers to as a String you encase the expression in quotation marks. When "1"+"1"="11" Concetation is when strings and or variables are joined.it is not intended as a mathematical formula simply a means of bringing two or several strings and or variables together Such as MyVar1 add" some stuff goes here." +MyVar2 add" more Stuff"; About the Enter Key,,,,, If you wish to use a keypress function you may.... Use the Event Button>On kepress<"enter"> Where to go from here. Once you get the hang of dynamic text expressions and input text it is much easier to digest things such as Loading and sending variables.creating mathematical equations and dancing with squirrels. Why the stuff about not making dynamic/input text a target? When you make any object a target you change the nature of the object it now becomes wrapped in a sprite. Which is why if you made your text objects target you recieved and error in the debug stating cannot find target. "targets" are great for simplifying draggable objects or when you simply want to load something such as a movie into a rectangle. However for the most part many of us are simply used to converting objects to sprites for the added benifits they bring. If you associate dynamic text (as in the case when you want it to be a target) with a variable meaning have a different name for the variable then the text object. Personally I see it as one more step that really is never absolutely required When you do associate dynamic text with a var name the two cannot have the same name. Still struggling? here's the SWI
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|